How to save optimized png images with java's ImageIO?

Posted by Christoph on Stack Overflow See other posts from Stack Overflow or by Christoph
Published on 2010-04-21T16:48:39Z Indexed on 2010/04/21 16:53 UTC
Read the original article Hit count: 228

Filed under:
|
|
|

I am generating lots of images in java and saving them through the ImageIO.write method like this:

final BufferedImage img = createSomeImage();
ImageIO.write( img, "png", new File( "/some/file.png" );

I was happy with the results until Google's firefox addon 'Page Speed' told me that i can save up to 60% of the size if i optimize the images. The images are QR codes, their size is around 900B each and the firefox-plugin optimized versions are around 300B. I'd like to save such optimized 300B Images directly from java.

So here my question again: How to save optimized png images with java's ImageIO?

© Stack Overflow or respective owner

Related posts about java

Related posts about pagespeed