Multiple JPG Edits Degrades Quality

Question: Does editing an JPG image multiple times degrade the image quality, cause shifts in color or loss of sharpness?  The answer is yes, even if compression is turned off. Although you can tell your editor to save JPG uncompressed, it still introduces compression and the image quality degrades with each generational edit.  This article explores loss of quality during multiple editing iterations.

The Experiment:

As an experiment, I took a simple, mostly black and white image, and sent it through ten generations of edits, storing the file uncompressed.  At each step, I checked for changes in color and sharpness.  What I found was each generation had a degradation in quality, with the most pronounced being the first.

The Test Image:

A simple letter-form 'abc' with a horizontal line was chosen because the edges are more descernable than a photograph and can be accurately and reliably reproduced.  The image was originally built in PaintShop Pro X5 and was stored in a non-compressed PSPimage format, then converted to JPG for testing.

Note: This blogging tool only accepts JPG images and has already introduced its own compression.  Because of this, the red is not a pure red in the illustration above.  See below for a more accurate description.


Image details:
Original, uncompressed 'abc' as a .pspimage:
Size: 488 x 458px, 195,000 bytes

An ICC Color profile was not applied
All colors preserved without a loss in quality


Red color palette:
Red = 255
Green = 0
Blue = 0

In the test picture above is a small, one-pixel, pure-red dot just below the letter 'b''s bowl.  The dot is pure red and is not anit-aliased.  Along with this dot are several other anti-aliased pixels, illustrated below, and each will be monitored for changes.  Note the red line marking the base of the font.  This line is anti-aliased and is not, nor expected, to be a pure red.  Magnified 3000%, the areas of interest are shown in this illustration.



Compression

If allowed, all picture / photo-editors, by default, compress images -- they will do this with both their native and JPG formats.

For example, in PaintShop Pro (PSP), both the .pspimage and .jpg menus have default compression settings.  For these tests, compression was turned off during the initial File-Save-As.  Adobe Photoshop has similar settings. 

Compression Settings - Click for larger view


When the test file was saved at various compression levels, the file-sizes were:

Test Image File Sizes:
.pspimage - Original 195k  (non-compressed)
.pspimage - default compression lzh       16k  (image not shown in this post)
.jpg - Generation 1 14k
.jpg - Generation 5 17k  (note larger filesize due to artifacts)
.jpg - Generation 10 17k  (artifacts also shifting in color)

The author recommends turning off compression in all images. In the case of a .pspimage, the default compression is simply too aggressive and with JPG's, the space saved is miniscule.  

In PSP, change your defaults by opening any image and do a Save-As in each format (.pspimage, .jpg, .Tif, etc).  Click "Options" and choose your compression settings.  PSP remembers these settings for all subsequent images, until changed.  At the same time, consider disabling ICC profiles, in both the save-as and File, Preferences menus.


First Generation .jpg

Saving from the original, uncompressed .pspimage to .jpg, dropped the file size from 195k to 14k - a remarkable drop in size.  Even though PSP was told to not compress .jpgs, by their very nature, does some compression.  Here is the first-generation results, at 3000% magnification:


It is evident that the one-pixel red is no longer red.  Its RGB values should be
R=255,
G=0,
B=0,

but it has already digressed to
R=103,
G=65,
B=64

-- more of a brown than a red.  The first illustration in this article is that first-generation file uploaded to this blog entry.

Also notice the anti-aliasing pixels, they have shifted to brown and the red-line has numerous pink artifacts 1 pixel above and 2 pixels below, which can be seen as a pink shadow under the red line.  As more generations are introduced, these artifacts will multiply and experience their own color-shifts.

5th Generation .jpg

Opening the first-generation .jpg, I made a minor editing change, not visible in the magnification, saved and closed, then re-opening and repeating four more times.  The fifth generation edit shows another fairly dramatic shift in color. 

The Red Pixel shifted to
R = 84 - a large drift from Red
G = 72
B = 74

Other anti-aliasing pixels had similar shifts.  The red-line has more artifacts, extending 4 pixels below and 2 pixels above.

(Note: The editor disguises some of the compression until the file is actually closed.  This is why the file was closed and re-opened during each pass)


10th Generation .jpg

The 10th generation edit shows these, less dramatic results -- after all, most of the red has been compressed out of the image.


All pixels danced around the previous values, with minor color-shifts downward.  This generation showed more artifacts as the previous artifacts drifted from their original colors. 


Side-by-Side results

(Again, this blogging tool only accepts JPG and by definition, the red-line has already shifted colors.  In reality, this uploaded image is a second-generation .jpg image.  The left-half is now a third-generation and the right is a twelfth.  And there is a problem with color shifts caused by your monitor, which are not corrected by an ICC profile.  In any case, the original editor shows a bold, new red line, that is pure red, in all of its glory.)

What does this mean?

Numerous edits to a .jpg will soften quality and mute colors.  This was a stark example and these changes are more difficult to detect in a normal photograph.  Photographs are not as compressible as this black, white and red image, but there is compression none-the-less.

There are other caveats with this experiment.  Other photo-editors may behave differently, but I suspect they all do nearly the same thing.  Finally, PSP did not have a zero-percent compression setting for jpg files -- the best it could do was 1%.  I suspect all JPG's must be compressed.  Consider the first generation save, even at 1%, still dropped the file-size from 195K to 14K -- clearly it is being compressed even though I moved the slider-scale to the far-left.

Recommendations:

For the best quality photos, follow these recommendations
  • Do not allow the camera to save as .JPG - even at high quality.
  • Save images as RAW.
  • Confirm the photo-editor can read the camera's proprietary RAW format.
    ---------------------------------------------------------------------------------------------
  • Edit photographs in the editor's native format
    (for example, in PaintShop Pro, use .pspimage, Photoshop PSD / PSB).
  • Turn off native compression in the editor.
  • Convert to .JPG as a last-step, if sending in email or posting online; keep originals.
  • If editing in .JPG, turn off file-save-compression!
Of course, this impacts file-sizes and large files can be impossible to edit on older computers or older 32-bit operating systems. 

Non-compressed file-sizes can be painful:

Consider a recent series of photos I took.  5 exposures for one scene.  Each exposure was stored as RAW, then HDR'd into a final image.  Look at these large file sizes -- they they will have their full fidelity:

Image-1    17MB  (16 megapixels, stored RAW, no compression)
Image-2    17MB - various exposure compensations, 2-5
Image-3    17MB
Image-4    17MB
Image-5    17MB
HDR Image - 114 MB -- for one image!

Read about this large HDR image in this related article:
Stanley Forest Burn Photo - imageLiner.blogspot.com


Conclusion:

This experiment was done in ideal conditions, using no compression and with a relatively simple image.  Now imagine if you allowed Paintshop Pro .jpg images to have a default 7 to 20% compression each time you saved the file!  Compression (and loss) would be rampant. 

An addition to this article showing an actual photograph is pending.
Your comments are welcomed.

Related links:
www.imageLiner.blogspot.com

Multiple JPG Edits Degrades Quality Multiple JPG Edits Degrades Quality Reviewed by Unknown on 10:55 AM Rating: 5

No comments:

Powered by Blogger.