sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #36285
Re: [Question #280571]: How to convert a Region snapshot to a java byte array.
Question #280571 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/280571
Status: Answered => Solved
Spencer Keller confirmed that the question is solved:
Thanks RaiMan. I saw in the ScreenImage javadoc that it is a "CANDIDATE
FOR DEPRECATION" so I was trying to stay away from using it but I guess
I will for now. Below is my final solution for others:
Screen scr = new Screen();
BufferedImage img = scr.capture({someRegion}).getImage();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(img, "png", baos);
baos.flush();
byte[] byteImage = baos.toByteArray();
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.