How can I compress jpeg images in Java without losing any metadata in that image?
Posted
by guitarpoet
on Stack Overflow
See other posts from Stack Overflow
or by guitarpoet
Published on 2009-06-04T02:50:24Z
Indexed on
2010/05/19
16:10 UTC
Read the original article
Hit count: 188
I want compress jpeg files using Java. I do it like this:
- Read the image as
BufferedImage
- Write the image to another file with compression rate.
OK, that seems easy, but I find the ICC color profile and the EXIF information are gone in the new file and the DPI of the image is dropped from 240 to 72. It looks different from the origin image. I use a tool like preview in OS X. It can perfectly change the quality of the image without affecting other information.
Can I done this in Java? At least keep the ICC color profile and let the image color look the same as the origin photo?
© Stack Overflow or respective owner