menu

JPEG Image Compression Degradation

Posted Sunday, January 31st, 2010

Professional photgraphers and graphic designers will be aware that .jpg or .jpeg digital photographs that are to be edited several times should first be saved into a 'lossless' file format such as .tif (TIFF), .png, or .psd. This is because JPEG is a method of lossy compression for photographic images, using an algorithm to a standard specified by a committee called the Joint Photographic Experts Group.

This may seem academic, but anyone who enjoys messing around with .jpg images and ignores this fact risks degrading their quality bit by bit, until they end up with photos of significantly lower quality than the originals, which are perhaps lost forever.

When you open a .jpg image in Adobe Photoshop you should be able to see its kilobyte size down at the left of the status bar towards the bottom of the screen. It might read, say, © Doc: 950K/950K. When the image is saved and closed, its file size will be, say, 323 KB - about one third of what it was when it was open in Photoshop. Other than when it's open for editing, the photo is stored compressed.

Compression permanently removes some of the original .jpg image information, slightly reducing its quality. When the file is next opened, that quality will not be restored, even though it's decompressed and back up to 950 KB in size. If it's saved and closed again, compression removes yet more quality, and so on as the image gradually degrades. This happens even when you don't edit it. If the image is also edited before it's saved, even more of its quality may be lost - I don't know, as I haven't tested this procedure in detail.

Below are two .jpg images. The first is the original file, with beautiful, gently graded skin tones. The second is the same image after it was saved and closed, then opened again, 50 times. It has not been edited in any way but has simply been repeatedly opened, saved, closed. The degradation is clearly visible on the woman's skin, especially on her forehead, nose, cheek, and chin.

The original .jpg photograph

The same photo opened, saved, and closed 50 times

Saving a .jpg image alone has no effect on its quality as long as it's left open, as JPEG works from the on-screen version. Neither does simply opening and closing the image without saving it. The damage occurs only when you save it before you close it. Many people will know that optimizing an image for the web reduces its quality, but this is also the case when the 'maximum' quality setting of 100% or 12 is selected in 'JPEG Options'.

You can eliminate much of the problem by saving the .jpg images that come off your digital camera as .tif (TIFF), .png, or .psd files for editing, and saving them back to .jpg when you're finished.

At this point you optimize an image for the web by saving a version with a lower quality setting than 100%. A setting of 75%, or 'medium', reduces an image file size considerably, making it very much faster to download into a web browser or email client without much visible loss of quality. Note that the optimization process reduces the quality of the image in a different way than when you compress it by merely saving it. The following version of the same photo has been optimized down to a setting of 5% - the degradation is obvious, but different.

The original .jpg optimized to 5%

Considerable loss of detail. Blurry in some places, gritty in others.

Page last modified: October 03, 2018

Comments


Posted by Calin Rotaru

June 12th, 2010 at 16:54

I have tried to reproduce your results, without any effect. It seems to me that photoshop besides decompressing the image also applies a graining/smoothing step to reduce jpeg distortions or something similar.

Normally there is no major degradation of the image by repeating the open/save operation again and again. The reason is that after the first compression step, the image colors are shifted to improve the jpeg image. After the second open the colors are already very close to the jpeg compressed data and there will be no significant change anymore.

You should try other tooling, photoshop is sometimes kind of blackbox here. I worked here with an image converter, AZImage and set JPEG Average, the quality to 75 out of 100, DCT float, optimize for the jpeg library. I have tried also with int instead of float to exclude for numerical errors, but the same. I cannot say that this behavior comes from the jpeglib.


Posted by Patrick

June 12th, 2010 at 22:03

To clarify. I did the experiment two ways. You can't simply open and save an image (in Photoshop at least). Either (i) it has to be edited in some way before you can Save it with the same filename or (ii) you can open it and Save As with a new filename without any edits. The edits in the first experiment were flipping the image back and forth, and there were no edits in the second.

The result in both cases was the same degradation effect, which tends to agree with what is written here when using a 'a regular image editor'. I've repeated the experiment in CS4. Same result.


Posted by Ben

January 1st, 2011 at 00:54

I think the article is a bit misleading as has already been pointed out by Calin. Patrick then states the actual facts in his reply, but then for some unknown reason states that the contradiction or at least correction agrees with what was written above in the article. In the article it clearly states that opening and saving the jpeg in photoshop without any editing will degrade the jpeg. This is misleading and the reality is noted in Patricks reply… either the image has to be edited or the "save as" not the save option has to be used for image degradation.


Posted by Patrick

January 2nd, 2011 at 10:41

The article describes that when you open, save, and close a .jpeg in Photoshop some quality is lost. My reply to Calin simply clarifies that to save a file you must either edit it or give it a new filename.

Leave a comment

Patrick Elsewhere

The art of Françoise Taylor:
paintings & drawings by my mother, vécue 1920-2007