Page 1 of 1

Do JPEG recompressions degrade images?

Posted: 2009-11-21T10:15:14-07:00
by Silvestro Fantacci
I am running a simple Magick++ application that does the following:

- Create a sample 8x8 Image X1.
- Set X1 type to JPEG.
- Set X1 quality to 95.
- Save X1 to Blob B.
- Create Image X2 from B.
- Set X2 type to JPEG.
- Set X2 quality to 95.
- Save X2 to B.
- Create Image X3 from B.

For quite a few sample images, X2 and X3 turn out to be different.

For instance, starting from this sample image: Image, it takes some 25 iterations to get to a stable state where the source and the target images are identical.

It looks a bit strange to me that the JPEG compression and decompression algorithms should not be "symmetrical".

Maybe I have made a mistake in my application... or has anyone else come across these kinds of results?

Re: Do JPEG recompressions degrade images?

Posted: 2009-11-26T09:11:01-07:00
by Silvestro Fantacci
I have found the answer here:
http://www.codinghorror.com/blog/archives/000629.html
I was also curious what the image quality and file size penalty was for recompressing a JPEG image. That is, opening a JPEG and re-saving it as a JPEG, including all the artifacts from the original compressed image in the recompression. I've been forced to do this when I couldn't find an uncompressed or high quality version of the image I needed, and I always wondered how much worse it made the image when I recompressed it. [...] I was quite surprised to find that there's very little visual penalty for recompressing a JPEG once, twice, or even three times. By generation five, you can see a few artifacts emerge in the image, and by generation ten, you're definitely in trouble. There's virtually no effect at all on file size, which stays constant at 30-31 kilobytes even through generation 15.