PDA

View Full Version : JPEG compression, re saving and eventual destruction(for Phil/OzzieTraveller)



arthurking83
15-08-2012, 9:33pm
We all know that you're not supposed to resave jpgs after editing, over and over again, and that you should keep a master copy if you work in jpg mode and edit that one and keep copies of those saved files and so on and so forth.

But some time back a discussion ensued as to why we don't see any real difference after saving a jpg file say, only a few times.
I guess most of us may only save a new copy of a edited jpg file perhaps once or twice edited, and hence we won't see the degradation of the jpg data after only a very minimal generational change.

But what happens to a jpg image after repeated saves?

Can you imagine yourself sitting there saving and resaving a jpg file over and over and over again?
Well for the earlier discussion with some members, I did!.. although I think I only saved my file 6 or 7 times and kept each file for comparison purposes, and after 7 saves I saw no difference in the 7th generation of the jpg file.
Damned!! should have used scripting!! Doh!

Anyway .. someone a lot smarter than myself has done so, and ...


it's easier just to link to the specific information! (http://www.petapixel.com/2012/08/14/why-you-should-always-rotate-original-jpeg-photos-losslessly/) :D

and HERE'S (http://www.reddit.com/r/photography/comments/axuqo/you_might_know_that_if_you_save_a_jpeg_file/) an even more detailed version of jpg saving resaving and so forth...

What I think I tried to explain to Phil in one reply was that at some point in the jpg saving routine(compression to jpg) that there must be a particular compression routine, that didn't affect the data too badly, so that just a simple saving of the already saved jpg file didn't obviously degrade it.
Making an obvious edit to the jpg and then resaving it over itself is probably where the data compression loss occurred to the point where it became obvious in the file.
And I think the topic of file sizes came up in the discussion too, and that I'd found that if you resaved an image(with no editing at all) and continually used a set compression level, the file size doesn't diminish with every save.
That is, if you started with a 1Mb jpg and saved that file to another file at 80% quality level, on the first save it may have compressed the file size somewhat eg. 600kb, but each save henceforth on that save file, would not compress the file size in any meaning full manner, if at all, and it'd remain at 600kb, rather than reduce to, say, 480kb(80% of 600kb).
(but the same software had to be used for each save).

Each software I had access too, did produce a different file size relative to each other for a given compression level, but each of the software's I used, LR, Nikon ViewNX2 and FSViewer, would not produce smaller file sizes with just a resave using the same compression level.
You would expect that if you set the software to save the file at 80% of a given file size,(eg original at 1Mb), then at 80% you would get an 800kb saved file, and then 640kb(80% or 800kb) for the next generation and so on for each generation ....

In the second link is a very solid reason as to why this would happen, and that is that the codec routine is simply bit exact for each operation, simply decompressing and recompressing without any real change.

This obviously changes as the file is edited and resaved, but for a simple open and resave, there should be no change in quality nor file size.

Anyhow, just some useless info on jpgs(and why it's better to use raw if you have that ability) .. just don't write scripts that resaves or rotates your jpg files losslessly 600times !! :D

OzzieTraveller
16-08-2012, 7:26pm
G'day Arthur

I am overwhelmed by the amount of text in your answer :eek: :eek: > you have obviously had fun chasing things up


We all know that you're not supposed to resave jpgs after editing, over and over again, and that you should keep a master copy if you work in jpg mode and edit that one and keep copies of those saved files and so on and so forth.


My OP related to my experiments with Jpeg saving vs magazine articles I have read with illustrations demonstrating the effects of saving an image "multiple times" during editing. And here the "multiple times" is implied to be 3-4-5-6 or so times over the couple of hours that the user is editing the image

The magazine illustrations show the original image - nice and clear - vs the saved/resaved JPG image which had bloody great pixellation all over it, thus destroying the image completely

My experiments over a similar number of saves could not replicate the "alleged" destruction of an image as demontrated in the magazine article: so I asked others here on AP for their help to replicate my experiments for, shall we say, peer review to validate my results. It was one of a number of items I was seeking peer-review of my findings where those findings go against so-called conventional wisdom ... as outlined in the first dozen or so words in your quote above

The fact that some fella has done a save 2000 times is completely irrelevant to my thesis
It is in the same league as the fella who stacked 200 UV filters together, saw the result and then claimed that the use of a single UV filter degraded the image quality and should not be used at any time.

If you or others here would like to have a go with this or other items of concern to me - which all involve printing the results to confirm the thesis, I am more than happy to work with you / them to do so. All I am trying to do is decide which parts of "conventional wisdom" actually apply vs those items that are little more than salesmanship &/or mushroom-fertilizer

Regards, Phil