![]() |
|
[Java] Grab region of screen - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Java] Grab region of screen (/showthread.php?tid=5177447) |
Grab region of screen - quartzd - Feb 20, 2016 Hi im not really sure how to explain this problem but i want to be able to grab pixels from a rectangle region on a screen at position x1,y1 and x2,y2 and copy those exact pixels onto a form... hard to explain I think Here is a basic image example It would look like that..where the red rectanagle region is copied into the form as the image shows.. does anyone know how I could do this? i.imgur com/iP8iIwp.jpg (can't post links....) If anyone can post the image here for me that would be nice thanks * - MrOrang - Feb 20, 2016 You can get a picture of the entire desktop then only get the select area and save that image. Cant code atm so this is the only bit I can help. * - Sogomn - Feb 20, 2016 Check out the class "Robot" in the "java.awt" package. Can do exactly what you want. Click. * - quartzd - Feb 22, 2016 (Feb 20, 2016 08:08 PM)Sogomn Wrote: Check out the class "Robot" in the "java.awt" package. Can do exactly what you want. Thanks I solved that problem...but now I need to make the bufferedimage transparent * - Sogomn - Feb 23, 2016 (Feb 22, 2016 06:39 PM)quartzd Wrote: Thanks I solved that problem...but now I need to make the bufferedimage transparent But your screen is not transparent. What do you mean exactly? Do you want to add an alpha channel? Simply convert it. Code public static BufferedImage convert(final BufferedImage image, final int type) {Then call it like this: Code final BufferedImage alphaImage = convert(screenImage, BufferedImage.TYPE_INT_ARGB); |