# Does Saving a JPEG Multiple Times Reduce Image Quality?

When photographers start debating the advantages of shooting RAW rather than JPEG, I inevitably hear that one advantage of shooting in RAW is that you can save it multiple times without reducing image quality.

In theory, this is absolutely true.  Every time a JPEG image is saved, compression algorithms are run to reduce the file size.  This means that some data is lost every time you make a change to the photo and save it.  In contrast, RAW is what is called a lossless format.  It makes no difference how many times you edit a RAW file, it will always contain the exact same data.

Without any doubt, the RAW format offers clear advantages over shooting JPEG.  The most important of those advantages is the latitude to edit exposure and picture style.  The added information in a RAW file makes editing much more successful.

However, I often find that photographers take this too far and imagine that saving a JPEG multiple times is doing more harm that it actually is.  To see just exactly how much the pixels are altered buy saving a JPEG multiple times, I got one image and saved it out running compression on the image.  Then I painted one pixel white on the file just so it wouldn't leave the file untouched, and then I took the resulting JPEG and repeated the process.  In all, I saved the original photo 30 times.

Even after saving the photo 30 times, I found no noticeable reduction in image quality.  None.

Granted, this test would certainly have turned out very differently if the test were performed while saving out lower quality JPEG images upon each save.  In my testing, I saved the photo out as the maximum quality JPEG to prove my point.  Clearly, this would not hold true if you save the photo in low quality.

If you enjoy these daily photography tips, please LIKE Improve Photography on Facebook so you don't miss any of them!

### 11 thoughts on “Does Saving a JPEG Multiple Times Reduce Image Quality?”

1. A more realistic test would be to make a small global change to the picture – like adjust exposure or contrast or whatever a tad – save and reopen and adjust back. Repeat this until the image degrades. Touching one pixel will change the area around it after compression, but the change will be mostly confined to the area around that single pixel, given the way the compression algorithm works.

2. “In my testing, I saved the photo out as the maximum quality JPEG to prove my point”

Duh, if the image is being saved at maximum quality (i.e. no compression) each time then no information is being lost. What are you trying to prove?

The default settings of most photo editing programs have the JPG quality between 90% and 95% – so for Joe Public the story about repeated saves meaning a loss of quality is not a myth.

3. You must have done something wrong. I took your comparison picture above, opened it in Photoshop, painted one white pixel, and saved it in JPEG format with maximum quality. I then closed it, opened it again, painted another white pixel in the exact same spot just to change the file, and repeated the process. I got tired after the 15th time, but by then the image had deteriorated noticeably. Have a look at the result:
img827.imageshack.us/img827/7339/7bd7yegc15.jpg
Here is the original image from the article:

4. Victor: JPEG at maximum quality is not lossless.

Martin: You did not make a global change, which is why there were no degradation.

Look, guys (an this includes the writer of the article). None of this is news. Have a little faith in the experts. It was all explained 10 years ago in the JPEG FAQ: Multiple re-compressions at the same quality level and with local changes to the image does not degrade image quality. Global changes and/or changes to compression does.

http://www.faqs.org/faqs/jpeg-faq/part1/section-10.html

5. Most of whatever you articulate is astonishingly legitimate and that makes me ponder the reason why I had not looked at this in this light before. This piece really did switch the light on for me as far as this subject goes. But at this time there is just one issue I am not too comfy with so while I try to reconcile that with the actual main idea of the position, permit me see exactly what all the rest of the readers have to say.Nicely done.

6. I can see that myth having it’s roots in the old days, when the Jpeg compression algorythm was not so advanced. i remember having my computer graphic and design courses around 2001 and being told that saving jpeg multiple times could give me quality loss… Nowaday, i’d be surprised to se any difference. Thanks for the infos though, cause i was still old-school !

7. I suspect that the videos and demos showing significant image degradation of images after recursive recompression are the result of one of the following:

* Bad compression or decompression algorithm.
* Bad program design, such as altering image data after decompression or before compression.
* User error, such as selecting a different quality level during one of the iterations.
* Intentional fakery.

JPEG and related algorithms work by converting sequences of numbers, which represent pixels contained in “blocks”, into into sequences of numbers, which represent the detail contained within each block (DCT). The numbers that represent the highest level of detail are zeroed out at a level that is considered good enough (quantization). Then some standard lossless compression techniques are used to finish.

Recursively quantizing image data at the same quality level should throw away approximately the same level of detail at each iteration. Eventually, equilibrium should be reached, where the input is identical to the output. The following bash commands can be used to demonstrate this equilibrium using Imagemagick on Linux:

i=1000; j=1 ; q=50
convert original.png -quality $q “$i.jpg”

while [ $j -eq 1 ] ; do convert “$i.jpg” -quality $q “$((i+1)).jpg”
\rm “$((i-1)).jpg” i=$((i+1))
diff “$i.jpg” “$((i-1)).jpg”
j=\$?
done

Equilibrium appears to occur more rapidly at lower quality settings.

8. Logically, repeated saves would seem to accumulate deterioration; however, editing isolated spots/ single pixels does not make any alterations to the overall algorithms which most people are going to be tweaking, i.e. white balance or exposure or contrast which all will generate an image-changing algorithm. Because the formulas are simplifying the available information every time an overall change is made, eventually the simplifications are going to collapse. I would expect to see the most apparent deterioration by making a major change in color balance or contrast, saving, then reversing the same change, saving again, then repeating, in order to accelerate the loss of the same information each time.
Name changes, along with stored image information, are all done in a separate part of a file entirely separate from the image data, so have zero bearing on the picture aspects.