Why images degrade editing JPEGs

Started 3 months ago | Discussions thread
ForumParentFirstPrevious
Flat view
Ysarex
Ysarex Senior Member • Posts: 1,833
Why images degrade editing JPEGs
12

There was a thread up the past week about editing Fuji JPEGs. I followed it and got involved especially toward the end trying to help out.

That thread contains evidence of a whole lot of confusion out there and since I've been planning to do this for class anyway here goes:

First some editorial comments; Yes of course you can edit JPEGs. And you can do that with nearly no penalty using today's cameras because of the high resolution of today's camera sensors. Big deal if you can't see it! The "industry" often learns things not understanding why and then just keeps repeating them when changes have come along that make them no longer applicable or radically alters conditions. Like the 300 PPI rule for print output, but we're not going there.

The "don't edit JPEGs rule" comes from 15 years ago when a DSLR had a 6 megapixel sensor. At that kind of resolution the image degradation that occurs when you edit a JPEG became quickly visible even in an 8x10 print or web-sized display image. My XT-2 saves 24 megapixel files. Heck my little Canon compact saves 20 megapixel files. That's a 400% increase in image resolution in 15 years -- that same change applies to how severe image degradation from JPEG editing appears. It's real and it's still there but we've basically pushed it aside with higher resolution image files. You can't see it so WTH are you worried about. NOTE: Figure that last one out and only edit full-res JPEGs before you resize for other uses. NEVER resize down first and then start editing a JPEG.

I'm going to illustrate here what happens. To do that we're going to have to pixel peep. If you're the kind of person who doesn't want to know how your camera and software work or why certain things happen that's fine. If you haven't emotionally matured beyond the age of 10 and feel compelled to make some snide comment go right ahead, we won't tell your mommy.

FACT: Any editing of a JPEG in any way whatsoever with any and all software causes image degradation that can't be avoided. The image degradation occurs as a result of interaction between the edit changes that are being made to the tone and color of the image with the JPEG compression grid that is embedded in the image. This is the primary, in fact overwhelming cause of the damage. Saving the image again as a JPEG does negligible additional damage.

How JPEG works: JPEG is great and it works really well and we should all be very appreciative of it's creators -- it is awesome technology. JPEG lays out a compression grid over your image of 8x8 pixels. That puts 64 pixels in a grid cell and because photo data is very dense the odds are that all or nearly all of those 64 pixels are unique. Uniqueness defies compression and we need instead redundancy. JPEG's job is to create redundancy by carefully going over those 64 pixels and making some of them the same. JPEG changes pixels in a grid cell so that when the job is done instead of 64 unique pixels there's only 32 unique pixels and 32 redundant pixels or only 24 unique pixels and 40 redundant pixels, etc.. JPEG is smart enough to compare the edges of one cell with the next and blend as it goes -- awesome.

Once completed we don't see the compression grid because JPEG has done such a good job -- the grid is there but it's invisible to our eyes. Both because it very small and also because JPEG has made smart decisions in what it changed.

Then we come along and edit that JPEG. As we alter tone and color in the photo we make changes that begin to expose the grid. The grid starts to lift up out of the photo. Because we're working with today's high res files we won't see it -- it can at worst look like noise added to the photo.

Once done JPEG can't be undone. There's no removal or repair available for JPEG compression and so all editing in any form will encounter the compression grid and ugly artifacts will result. What we want to do is edit as little as possible and edit only once ideally with a parametric editor. A point of confusion that seemed to be prevalent in that earlier thread was the non-destructive function of parametric editors. Yes, parametric editors make no changes to the original JPEG -- same applies to raw files. But when the parametric editor exports a new JPEG with edits the original JPEG file is opened and read into memory along with of course the compression grid. The edit changes then interact with the compression grid to do the damage as the new JPEG is exported.

Here's our example image:

In order to show you a section of the image without any JPEG degradation at all I saved a PNG file. Here's a 100% section of the image processed from raw with no compression applied. (RAF from XT-2 processed SilkyPix Pro 8):

Here's the camera JPEG which requires editing -- it's too dark and contrasty.

And now here's another PNG so that no further compression has been applied. This is the same 100% section you see above in the PNG from the raw processing but in this case you're seeing the camera JPEG edited to alter tone and color (mostly tone):

Look at the two PNG files at 100% side by side. Pay attention to the section of blue on the right and follow it up toward the out of focus petals. The damage in the second image is the result of the Fuji JPEG compression grid interacting with the edit changes. No additional compression was applied to get the PNG to you.

Editing the raw file as evident from the first PNG won't cause that kind of damage. If I save the edited JPEG as another JPEG little to no further damage will result. Here that is if you want to see it:

If I open either the PNG of the edited JPEG and or the second JPEG of the edited JPEG and start to make additional changes then I'll exacerbate the damage and make matter worse.

To wrap up, yes of course we can edit JPEGs and some of us have no choice. I know a guy who shoots pro-sports and he has to shoot JPEG. When we edit JPEGs image degradation occurs and can't be avoided but with modern cameras it's basically moot due to high res files. The damage is done by the editing of the JPEG.

Some hints: As already noted edit full-res JPEGs before re-sizing the image. NEVER re-size and then edit. The damage done will often appear as noise added to the image. Get a good grain simulator and add some film grain after your JPEG editing is finished. The film grain can look good and completely cover over the JPEG damage.

ForumParentFirstPrevious
Flat view
ForumParentFirstPrevious
Keyboard shortcuts:
FForum PPrevious NNext WNext unread UUpvote SSubscribe RReply QQuote BBookmark MMy threads
Color scheme? Blue / Yellow