JPEG recompression

Image






Quality






Sampling




Visualization

-

[First compression]

Iteration 000

[Stabilized]

Iteration 0

[First compression]

Difference

[Stabilized]

Normalised difference

[Quality degradation]

Image degradation for each successive recompression

What is this?

Introduction

This page aims to make demonstrate what cycles of recompression with constant quality settings do to JPEG's, when the content isn't changed explicitly. This is all empiric using ImageMagick, so do take care about extending the findings to other programs.

The theory is that cycles of recompression will at some point lead to a "stable" image, that doesn't degrade further. This requires that the same compressor with the same settings are used each time.

Another theory is that images with low compression (high quality) will deteriorate more with successive recompressions than images with high compression. This is what the JPEG FAQ #10 claims.

Methology

A Tcl-script is used that performs roughly the following steps:

  1. A source image is resized and saved as a BMP.
  2. The BMP from #1 is converted to a JPEG.
  3. The JPEG from #2 is remembered as "last".
  4. The JPEG "last" is converted to a BMP.
  5. The BMP from #4 is converted to a JPEG.
  6. The JPEG from #5 is compared to "last". If they are byte identical, the script terminates.
  7. The JPEG from #5 is remembered as "last".
  8. The scripts jumps to #4.

The conversion to BMP and back to JPEG forces a decompression/recompression.

The script leaves us with the original image and the stabilized image, plus a count for how many cycles it involved. While iterating, the difference between the successive images are collected and used for the graph. The difference between the first ant the last image is calculated at the end and visualized as Difference and Normalised difference.

The test-images and the results can be seen below.

Conclusion

As can be seen, some of the images at low compression settings doesn't stabilize within the allotted number of iterations (100). However, the degradation graph shows that the deterioration decreases for each cycle.

It seems that the other theory - that images with low compression suffers more from recompressions than images with high compression - generally holds for the test images at this page. The strong exception is the Stresstest at 1x1 sampling.

Also worth noting is that the chroma sampling has a big effect on deterioration.

Martin Brown has made another page about this subject.

Feedback

Should anybody have any comments, suggestions, test-images or corrections, feel free to send me an email or use the form below.

Posts will be displayed on this page. Only plain text, please: HTML will be filtered.

Toke Eskildsen (te@ekot.dk)
2007-06-24