Link to home
Start Free TrialLog in
Avatar of VolSpeak
VolSpeak

asked on

take a screen shot and store it


Hi, I want to take a screenshot of a particular screen on on my system and store it as a jpeg. Is it possible to do this? If so how do I specify where to save the screen shot on my pc? Also is it possible to specify what program I want the jpeg (just this specific jpeg, not all jpegs on the system) to open with? in this case mozilla firebird. Thanks
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can use
Runtime.getRuntime.exec()
to open the java file in some specific program
Avatar of VolSpeak
VolSpeak

ASKER


Thanks for that CEHZ, this is the code im using:

  // capture the whole screen
BufferedImage screencapture = new Robot().createScreenCapture(
   new Rectangle(10, 10, 900, 750));
   
   // Save as JPEG
     File file = new File("screencapture.jpg");
     ImageIO.write(screencapture, "jpg", file);

For a points increase:
 The screen I want to capture has a scroll, is it possible to include the unscrolled part of the screen in the capture as well?
>>is it possible to include the unscrolled part of the screen in the capture as well?

AFAIK - no. Only what's visible. btw what kind of desktop scrolls?
Its an open file, do you know of any work around?
Apologies, not double accounts with one user, theres two of us using the same system....
Ive just had an idea, can the resolution of the screen be changed using java so the whole file will be within the window?
>>can the resolution of the screen be changed using java so the whole file will be within the window?

Yes, but not without JNI or a Runtime.exec call
8-)