• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

After screen Capture(to a Gif File)?????????

 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nate i've captured the screen & put it in a BufferedImage.I've used Jpegencoder to encode &
save it to a jpeg image file.How to improve the quality of the jpeg image& how to increase the
resolution of the image? I also want the BufferedImage to be saved as a gif file.Please reply this Nate.
The source is:
.............
Robot rob=new Robot();
Dimension d=Toolkit.getDefaultToolkit().getScreenSize();
System.out.println("dimension: "+d.toString());
BufferedImage bi=rob.createScreenCapture(new Rectangle(d));
File file = new File("test.jpg");
FileOutputStream out = new FileOutputStream(file);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bi);
param.setQuality(1.0f, false);
encoder.setJPEGEncodeParam(param);
encoder.encode(bi);
.................
Happy middling with java.
Netharam.:confused.
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JPEG is a compressed image format, so there is always going to be some image degradation... The basic Java API's will read GIF's, but will not write them ( I'm assuming this is because of the idiotic Unisys GIF software patent. ) so you'll have to use a third party library... there are a list of several on this page.

-Nate
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic