4

I'm attempting to save a BufferedImage as JPEG using ImageIO. But even when saving using 100 quality, I am suffering quality loss due to Chroma SubSampling.

I have successfully fixed this issue by reverting to the older JAI libraries and explicitly setting the Horizontal and Vertical Subsampling to 1. However a critical requirement is that I save the image as Progressive, which JAI doesn't seem to support.

Is there a way to disable sub-sampling using the newer ImageWriter?

Thanks in advance

If possible, I'd like to avoid ImageMagick

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
ejthurgo
  • 53
  • 1
  • 6
  • After extensive search on image writing/quality/compression issues. "Use ImageMagick" seems a common answer. Ideally I would like to know if this is possible in Java before going down the ImageMagick route. I am not against 3rd party libraries so long as they are lightweight and reliable. – ejthurgo Jan 04 '13 at 01:25
  • Thanks for clarifying. Maybe that information should be [edited](http://stackoverflow.com/posts/14149739/edit) into the question. – Andrew Thompson Jan 04 '13 at 01:27

1 Answers1

3

A reading of JPEG Metadata Format Specification and Usage Notes seems to suggest that this is possible by writing the image with a custom IIOMetadata.

A search on the internet brings up https://codereview.appspot.com/3082041/patch/204004/210007, which seems to use ImageIO in exactly this manner.

I haven't tried it, and have no idea if it actually works.

yiding
  • 3,482
  • 18
  • 17