• Post Reply Bookmark Topic Watch Topic
  • New Topic

ImageIO.write(...) significantly reduces quality of image...  RSS feed

 
Ivan Jouikov
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a jpg image that I load via ImageIO.read()...

I draw some text on the image and save it via ImageIO.write()...

Now the original image was 37kb. The new image is only 5 kb and has significantly lower quality. I wasn't able to find any quality-adjusting methods in the API

(http://java.sun.com/j2se/1.4.2/docs/api/javax/imageio/ImageIO.html)

Does anyone know how to preserve the image quality?

Thanks!
 
Ivan Jouikov
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I found the solution here:

http://javaalmanac.com/egs/javax.imageio/JpegWrite.html?l=rel

But instead of using the custom ImageWriteParam, use



Otherwise you get exceptions of compression mode not being supported.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!