mr_mooray
asked on
Java robot class capturing black/blank desktop images - Help
I am currently capturing various images from the desktop using the robot class. Yet every now and again my program will take a completely black image, which renders my program useless. Does anyone have any suggestion why this is happening ? and what I can do prevent or fix it ?
At the moment I just restart my computer and it seems fine, but I don't want this to happen on my clients computer.
Thanks
At the moment I just restart my computer and it seems fine, but I don't want this to happen on my clients computer.
Thanks
How are you running the Robot?
ASKER
try {
Robot robot = new Robot();
//capture a screenshot of desktop size
Rectangle captureSize = new Rectangle(Toolkit.getDefau ltToolkit( )
.getScreenSize());
BufferedImage capture = robot.createScreenCapture( captureSiz e);
//save to file
ImageIO.write(capture, "bmp", new File("C:/Desktop.bmp"));
//Set Desktop Image
desktopImage = capture;
} catch (HeadlessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (AWTException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Robot robot = new Robot();
//capture a screenshot of desktop size
Rectangle captureSize = new Rectangle(Toolkit.getDefau
.getScreenSize());
BufferedImage capture = robot.createScreenCapture(
//save to file
ImageIO.write(capture, "bmp", new File("C:/Desktop.bmp"));
//Set Desktop Image
desktopImage = capture;
} catch (HeadlessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (AWTException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
The screensaver hasn't kicked in has it?
ASKER
No all screen savers are disabled, it just returns a completely black image. I don't think its my code, do you think it could be a different program interfering ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
mr_mooray,
This question has been classified as abandoned. I will make a recommendation to the moderators on its resolution in approximately four days. I would appreciate any comments by the experts that would help me in making a recommendation.
It is assumed that any participant not responding to this request is no longer interested in its final disposition.
If the asker does not know how to close the question, the options are here:
https://www.experts-exchange.com/help.jsp#hs5
girionis
EE Cleanup Volunteer
This question has been classified as abandoned. I will make a recommendation to the moderators on its resolution in approximately four days. I would appreciate any comments by the experts that would help me in making a recommendation.
It is assumed that any participant not responding to this request is no longer interested in its final disposition.
If the asker does not know how to close the question, the options are here:
https://www.experts-exchange.com/help.jsp#hs5
girionis
EE Cleanup Volunteer