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

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top