Sign in with
Sign up | Sign in
Your question

jpeg lossiness ?

Last response: in Digital Camera
Share
July 4, 2005 3:15:44 AM

Archived from groups: rec.photo.digital (More info?)

I did a small trial for what I hoped would be a reasonable demonstration
of the cumulative effect of reopening and saving images as jpegs on
image degradation - by superimposing the compressed image as a 50%
transparency over an inverted colour image of the original. Do it with
two copies of the same image and the result is a uniform grey (in
practice not quite uniform but near enough).

Images are here:
http://www.geocities.com/angels2000photos/lossy/lossy.h...
The effect of opening and saving a jpeg many times seems to make far
less visible difference than the original or lowest quality setting does.
Have I missed something? - I was not expecting this result.
This goes against what I've been told - and my instincts.

More about : jpeg lossiness

Anonymous
July 4, 2005 3:15:45 AM

Archived from groups: rec.photo.digital (More info?)

frederick wrote:

> I did a small trial for what I hoped would be a reasonable demonstration
> of the cumulative effect of reopening and saving images as jpegs on
> image degradation - by superimposing the compressed image as a 50%
> transparency over an inverted colour image of the original. Do it with
> two copies of the same image and the result is a uniform grey (in
> practice not quite uniform but near enough).
>
> Images are here:
> http://www.geocities.com/angels2000photos/lossy/lossy.h...
> The effect of opening and saving a jpeg many times seems to make far
> less visible difference than the original or lowest quality setting does.
> Have I missed something? - I was not expecting this result.
> This goes against what I've been told - and my instincts.
>
>

That's why I always keep my original images. If I do anything more than
a simple rotation, I always save it as a separate file, but leave the
original intact (think of that as the digital negative).
Anonymous
July 4, 2005 3:15:45 AM

Archived from groups: rec.photo.digital (More info?)

frederick wrote:
> I did a small trial for what I hoped would be a reasonable demonstration
> of the cumulative effect of reopening and saving images as jpegs on
> image degradation - by superimposing the compressed image as a 50%
> transparency over an inverted colour image of the original. Do it with
> two copies of the same image and the result is a uniform grey (in
> practice not quite uniform but near enough).
>
> Images are here:
> http://www.geocities.com/angels2000photos/lossy/lossy.h...
> The effect of opening and saving a jpeg many times seems to make far
> less visible difference than the original or lowest quality setting does.
> Have I missed something? - I was not expecting this result.
> This goes against what I've been told - and my instincts.

Most programs will not recompress an image if it is simply opened and
then saved, you might try changing 1 pixel each time you open it and
see what effect that has.


Having said that I do note that a lot of people are just a bit too
paranoid on the effects of jpg compression. There is no doubt that
you can loose image quality, but it is the level of loss is often way
exaggerated. There is a feeling that it is the process of the
compression that is loosing the data in the photo and that if you do
this two time you will loose twice as much data, this is not the case.
What jpeg compression does in large part is to reduce the number of
bits that encode spatial frequencies that are not as important to the
image. If you recompression the photo it will tend to come up with the
same bit depth for the same spatial frequencies, and as such will not
have nearly the loss as the first time it was compressed.

Having said all that it is very easy to not to store a photo you are
working on as a jpg and avoid the worry altogether.


Scott
Related resources
Anonymous
July 4, 2005 3:15:45 AM

Archived from groups: rec.photo.digital (More info?)

"frederick" <nomail@nomail.com> wrote in message
news:1120389276.17188@ftpsrv1...
>I did a small trial for what I hoped would be a reasonable demonstration of
>the cumulative effect of reopening and saving images as jpegs on image
>degradation - by superimposing the compressed image as a 50% transparency
>over an inverted colour image of the original. Do it with two copies of
>the same image and the result is a uniform grey (in practice not quite
>uniform but near enough).
>
> Images are here:
> http://www.geocities.com/angels2000photos/lossy/lossy.h...
> The effect of opening and saving a jpeg many times seems to make far less
> visible difference than the original or lowest quality setting does.
> Have I missed something? - I was not expecting this result.
> This goes against what I've been told - and my instincts.

It doesn't go against _my_ instincts. JPEG compression is basically a lossy
translation ((lossy) discrete cosine transformation, a cousin of the Fourier
transform) from a (position,intensity) space to a (frequency,intensity)
space. But I'd expect the round trip translation from compressed
(frequency,intensity) space to (position,intensity) space to compressed
(frequency,intensity) space again to be close to lossless, because the
(position,intensity) space can represent more information than the
(frequency,intensity) space at a given compression.

If you didn't understand that, just repeat it out loud three times
quickly<g>.

David J. Littleboy
Tokyo, Japan
Anonymous
July 4, 2005 3:15:45 AM

Archived from groups: rec.photo.digital (More info?)

On Sun, 03 Jul 2005 23:15:44 +1200, frederick <nomail@nomail.com> wrote:


>Images are here:
>http://www.geocities.com/angels2000photos/lossy/lossy.h...
>The effect of opening and saving a jpeg many times seems to make far
>less visible difference than the original or lowest quality setting does.
>Have I missed something? - I was not expecting this result.
>This goes against what I've been told - and my instincts.

AIUI opening a jpeg and saving it again at the *same* compression level
generates the same result. Repeating it several times at *varying*
compression levels will degrade the result. Or repeatedly editing the
picture and then saving/reopening will also degrade the result.

--
Stephen Poley
Anonymous
July 4, 2005 3:15:45 AM

Archived from groups: rec.photo.digital (More info?)

In article <1120389276.17188@ftpsrv1>, frederick <nomail@nomail.com>
wrote:

> I did a small trial for what I hoped would be a reasonable demonstration
> of the cumulative effect of reopening and saving images as jpegs on
> image degradation - by superimposing the compressed image as a 50%
> transparency over an inverted colour image of the original. Do it with
> two copies of the same image and the result is a uniform grey (in
> practice not quite uniform but near enough).
>
> Images are here:
> http://www.geocities.com/angels2000photos/lossy/lossy.h...
> The effect of opening and saving a jpeg many times seems to make far
> less visible difference than the original or lowest quality setting does.
> Have I missed something? - I was not expecting this result.
> This goes against what I've been told - and my instincts.

Try trees, leaves, and bricks. Try red flowers over green leaves.
That's where compression usually chokes. JPEG tosses out small, faint
details and color detail when there's not enough bandwidth.

Saving and re-saving doesn't do damage unless you move some pixels
around.
Anonymous
July 4, 2005 3:15:45 AM

Archived from groups: rec.photo.digital (More info?)

All Things Mopar wrote:
> On this date, Kevin McMurtrie extended this wisdom for the
> consideration of other readers...
>
> > Try trees, leaves, and bricks. Try red flowers over
> > green leaves. That's where compression usually chokes.
> > JPEG tosses out small, faint details and color detail
> > when there's not enough bandwidth.
>
> I find that JPEG also wrecks havoc with seemingly broad expanses
> of "color" such as a clear blue sky. And, as you observe for
> trees, leaves, and bricks, I have to be /real/ careful with my
> major subject - cars. JPEG can destroy the fine detail in my car
> pix.

Each program that does jpeg compression has a ton of control as to what
date to redue as it lowers the files sizes, it is unfortunate that most
seem happy to compress smooth gradations overly aggressive. If the
balance were set well just at about the time the sky started looking
bad so would every thing else.


> And, to be absolutely sure I've not over-compressed, I /always/
> immediately re-opened my just-saved images to check before I
> blow away the in-memory bit map.

Most programs have a preview of what the image will look like once
compressed, When hard disk space cost a lot and I have a limited amount
I would try to save to as small a file as I could with out degrading
the image, now with cheap disk space the only time I try to reduce the
size of a photo is if it is going up on a web site, or if I am emailing
it.

I am like most people, if I think I am going to edit the photo again I
will start from the original photo if at all possible. I always keep
the original photos on DVD so if I decide I don't like the edit I did
on a photo I can go back and start with the original.
I have had to go back to these originals from time to time when I got
too aggressive at reducing file sizes in the past.

Having said all that I still thing there is great value when someone
does not just accept the current dogma and looks for themselves to see
what is happening.I think the OP is to be applauded to looking for
himself to see what he sees and sharing it with others.

Scott
Anonymous
July 4, 2005 3:15:46 AM

Archived from groups: rec.photo.digital (More info?)

On this date, Kevin McMurtrie extended this wisdom for the
consideration of other readers...

> Try trees, leaves, and bricks. Try red flowers over
> green leaves. That's where compression usually chokes.
> JPEG tosses out small, faint details and color detail
> when there's not enough bandwidth.

I find that JPEG also wrecks havoc with seemingly broad expanses
of "color" such as a clear blue sky. And, as you observe for
trees, leaves, and bricks, I have to be /real/ careful with my
major subject - cars. JPEG can destroy the fine detail in my car
pix.

And, to be absolutely sure I've not over-compressed, I /always/
immediately re-opened my just-saved images to check before I
blow away the in-memory bit map.

--
ATM, aka Jerry
Anonymous
July 4, 2005 3:15:46 AM

Archived from groups: rec.photo.digital (More info?)

On this date, Scott W extended this wisdom for the
consideration of other readers...

> Each program that does jpeg compression has a ton
> of control as to what date to redue as it lowers
> the files sizes, it is unfortunate that most seem
> happy to compress smooth gradations overly aggressive.
> If the balance were set well just at about the time
> the sky started looking bad so would every thing else.

Better apps allow you to select chroma subsampling in
addition to JPEG compression and whether or not to save
EXIF. This provides some control over how the
intentionally broadly-written JPEG spec is implemented
in software.

The problem comes when people expect Irfanview or Gimp
to perform similarly to the more robust algoritms in
apps such as PS CS or PSP, to name just two.

>> And, to be absolutely sure I've not over-compressed,
>> I /always/ immediately re-opened my just-saved images
>> to check before I blow away the in-memory bit map.
>
> Most programs have a preview of what the image will
> look like once compressed

Yes they do except that the preview isn't at all the
same as what you actually observe by re-opening the
file. Try it sometime varying not only the compression
as Frederick was testing by also varying the 10+ chroma
subsampling choices offered in serious graphics apps.
You can easily destroy an image by inappropriate
choosing this function.

I had one particular image that I took during the pre-
cruise gatherings for last year's Woodward Avenue Dream
Cruise of a 1971 Dodge Challenger. The PSP 8 JPEG
Optimizer preview showed all was well but when I re-
opened the file it looked as if I'd painted the image on
beach sand! I never really figured out what was peculiar
to this image but it took about 20 minutes of fiddling
with compression and chroma subsampling before I could
get an acceptable image. And, had I not did my dogma-
style "always re-open after save" routine, I'd have had
to start over on that picture.

> Having said all that I still thing there is great
> value when someone does not just accept the current
> dogma and looks for themselves to see what is
happening.
> I think the OP is to be applauded to looking for
himself
> to see what he sees and sharing it with others.

I'll be the first to agree that "dogma" always gets you
into trouble if you blindly believe it. A good example
is the "more mega pixels the better your pictures will
be" nonsense.

And, with respect to the OP, whom I also respect for the
time he spent investigating the compression phenomena,
it is quite a bit more complicated to conduct a
mathematically rigorous test of JPEG compression without
considering what specific manipulations of the pixels
went into the test. As the OP correctly observed, even
minor pixel changes can have a drastic affect on real or
perceived image quality.

--
ATM, aka Jerry
July 4, 2005 1:30:21 PM

Archived from groups: rec.photo.digital (More info?)

David J. Littleboy wrote:
> "frederick" <nomail@nomail.com> wrote in message
> news:1120389276.17188@ftpsrv1...
>
>>I did a small trial for what I hoped would be a reasonable demonstration of
>>the cumulative effect of reopening and saving images as jpegs on image
>>degradation - by superimposing the compressed image as a 50% transparency
>>over an inverted colour image of the original. Do it with two copies of
>>the same image and the result is a uniform grey (in practice not quite
>>uniform but near enough).
>>
>>Images are here:
>>http://www.geocities.com/angels2000photos/lossy/lossy.h...
>>The effect of opening and saving a jpeg many times seems to make far less
>>visible difference than the original or lowest quality setting does.
>>Have I missed something? - I was not expecting this result.
>>This goes against what I've been told - and my instincts.
>
>
> It doesn't go against _my_ instincts. JPEG compression is basically a lossy
> translation ((lossy) discrete cosine transformation, a cousin of the Fourier
> transform) from a (position,intensity) space to a (frequency,intensity)
> space. But I'd expect the round trip translation from compressed
> (frequency,intensity) space to (position,intensity) space to compressed
> (frequency,intensity) space again to be close to lossless, because the
> (position,intensity) space can represent more information than the
> (frequency,intensity) space at a given compression.
>
> If you didn't understand that, just repeat it out loud three times
> quickly<g>.
>
> David J. Littleboy
> Tokyo, Japan
>
It was easier just to test it than try to understand why.
July 4, 2005 1:38:00 PM

Archived from groups: rec.photo.digital (More info?)

Stephen Poley wrote:

> On Sun, 03 Jul 2005 23:15:44 +1200, frederick <nomail@nomail.com> wrote:
>
>
>
>>Images are here:
>>http://www.geocities.com/angels2000photos/lossy/lossy.h...
>>The effect of opening and saving a jpeg many times seems to make far
>>less visible difference than the original or lowest quality setting does.
>>Have I missed something? - I was not expecting this result.
>>This goes against what I've been told - and my instincts.
>
>
> AIUI opening a jpeg and saving it again at the *same* compression level
> generates the same result. Repeating it several times at *varying*
> compression levels will degrade the result. Or repeatedly editing the
> picture and then saving/reopening will also degrade the result.
>
Yes - that makes a big difference - thanks.
I have uploaded samples where I have made a change to the image 10
consecutive times (added a number for reference) and saved at 85% each
time. The image degradation is much worse than saving 20 times at 85% -
and about the same as saving once at 50%. (percentages are Gimp settings
- which compress far more at equivalent % than PS - PS's mid level 5 is
very roughly equal to Gimp's 85% quality setting)

So, if you open a jpeg, edit it, then save it as a jpeg at the original
compression level, then you are going to lose a lot more than if you
simply open the file, then save it at the same compression level with no
changes - in which case the loss is almost nil.
Anonymous
July 4, 2005 1:38:01 PM

Archived from groups: rec.photo.digital (More info?)

On this date, frederick extended this wisdom for the
consideration of other readers...

> I have uploaded samples where I have made a change
> to the image 10 consecutive times (added a number
> for reference) and saved at 85% each time. The
> image degradation is much worse than saving 20
> times at 85% - and about the same as saving once at
> 50%. (percentages are Gimp settings

Frederick, I'm having a tough time understanding why you
ever want to re-edit/save/re-edit/save the same image 10
times except for an academic exercise to see at what
point you will see image damage. I make this comment
after reading quite a few give-and-take posts in this
thread and just don't understand.

Prevailing "wisdom" about JPEG suggests that you keep
your original camera images in a 2nd folder and go back
to the original if you need to re-process a finished
picture. Yes, you can often get away with a re-save or
two but eventually you'll see noticeable damage,
particularly if you print at larger sizes.

Gimp apparently uses the same nomenclature as Irfanview
(neither of which I personally use) when compressing.
JPEG is a unitless scale of 1-100, which is /not/ in
anyway a percentage reduction. Perhaps these apps use
"percent" because most people visualize anything on a
100 scale as some sort of percentage.

But, IIRC, JPEG=1 was a design goal for the
specification to approximate the image size of an LZW
compressed TIFF - approximately half. Much over about
20-30 is really only useful when you absolutely must
minimize file size for E-mailing or something like eBay.

There's exceptions to every rule and there's little
agreement as to what a "good" compression number is or
what a "not to exceed maximum" should be. But, after
doing this on a variety of subjects over the last 10+
years (first scans, now scans and digital), I seldom go
over JPEG=15 to avoid introducing artifacts in my
pictures.

--
ATM, aka Jerry
July 4, 2005 1:47:35 PM

Archived from groups: rec.photo.digital (More info?)

Stephen Poley wrote:

> On Sun, 03 Jul 2005 23:15:44 +1200, frederick <nomail@nomail.com> wrote:
>
>
>
>>Images are here:
>>http://www.geocities.com/angels2000photos/lossy/lossy.h...
>>The effect of opening and saving a jpeg many times seems to make far
>>less visible difference than the original or lowest quality setting does.
>>Have I missed something? - I was not expecting this result.
>>This goes against what I've been told - and my instincts.
>
>
> AIUI opening a jpeg and saving it again at the *same* compression level
> generates the same result. Repeating it several times at *varying*
> compression levels will degrade the result. Or repeatedly editing the
> picture and then saving/reopening will also degrade the result.
>
Actually - saving multiple times at varying compression levels didn't
make a lot of difference - only very slightly worse than saving once at
the lowest compression level used in the varying compression level test.
Editing did make a big difference.
Anonymous
July 4, 2005 1:47:36 PM

Archived from groups: rec.photo.digital (More info?)

On this date, frederick extended this wisdom for the
consideration of other readers...

> Actually - saving multiple times at varying
> compression levels didn't make a lot of difference
> - only very slightly worse than saving once at the
> lowest compression level used in the varying
> compression level test. Editing did make a big
> difference.

Not disputing, just commenting. When I find that I simply must
re-edit a finished picture, I always save it to a larger file
size that the first image(that is, a lower JPEG compression
factor) so as to minimize any damage inherent in the re-edit/re-
save process.

You are right that damage occurs much more often from /what/ you
do in subsequent edits than purely from re-saving, but why give
Murphy an even break ever?

--
ATM, aka Jerry
July 4, 2005 4:06:32 PM

Archived from groups: rec.photo.digital (More info?)

All Things Mopar wrote:
> On this date, frederick extended this wisdom for the
> consideration of other readers...
>
>
>>I have uploaded samples where I have made a change
>>to the image 10 consecutive times (added a number
>>for reference) and saved at 85% each time. The
>>image degradation is much worse than saving 20
>>times at 85% - and about the same as saving once at
>>50%. (percentages are Gimp settings
>
>
> Frederick, I'm having a tough time understanding why you
> ever want to re-edit/save/re-edit/save the same image 10
> times except for an academic exercise to see at what
> point you will see image damage. I make this comment
> after reading quite a few give-and-take posts in this
> thread and just don't understand.
>
> Prevailing "wisdom" about JPEG suggests that you keep
> your original camera images in a 2nd folder and go back
> to the original if you need to re-process a finished
> picture. Yes, you can often get away with a re-save or
> two but eventually you'll see noticeable damage,
> particularly if you print at larger sizes.
>
> Gimp apparently uses the same nomenclature as Irfanview
> (neither of which I personally use) when compressing.
> JPEG is a unitless scale of 1-100, which is /not/ in
> anyway a percentage reduction. Perhaps these apps use
> "percent" because most people visualize anything on a
> 100 scale as some sort of percentage.
>
> But, IIRC, JPEG=1 was a design goal for the
> specification to approximate the image size of an LZW
> compressed TIFF - approximately half. Much over about
> 20-30 is really only useful when you absolutely must
> minimize file size for E-mailing or something like eBay.
>
> There's exceptions to every rule and there's little
> agreement as to what a "good" compression number is or
> what a "not to exceed maximum" should be. But, after
> doing this on a variety of subjects over the last 10+
> years (first scans, now scans and digital), I seldom go
> over JPEG=15 to avoid introducing artifacts in my
> pictures.
>
That is sensible, and yes, it was just an exercise so I could show why
it's a good idea to do as you suggest.
Everything was as I expected - except that I was surprised to see that
multiple saving didn't degrade the image much at all relative to the
damage done by compressing once at a lower quality - unless the image
was edited between saves. A bit obscure for the reasons that you point
out - it's a dumb idea to open and resave "for the hell of it" - but
actually does little harm, but a more likely situation that someone will
open, do a little editing, then resave a few times - will do more
damage, which I can show from my image samples.
Thanks.
Anonymous
July 4, 2005 4:26:45 PM

Archived from groups: rec.photo.digital (More info?)

Stephen Poley wrote:

> On Sun, 03 Jul 2005 23:15:44 +1200, frederick <nomail@nomail.com> wrote:
>
>>Images are here:
>>http://www.geocities.com/angels2000photos/lossy/lossy.h...
>>The effect of opening and saving a jpeg many times seems to make far
>>less visible difference than the original or lowest quality setting does.

The main losses are on the very first save.

>>Have I missed something? - I was not expecting this result.
>>This goes against what I've been told - and my instincts.

You have been misled. There are too many people bemoaning "JPEG
lossiness" that is actually due to either chroma subsampling or in
camera sharpening artefacts. Your instincts are wrong see the JPEG FAQ.

Good that you did the experiment though. The issue is more that the JPEG
losses can tip the balance unfavourably if you need to use contrast
enhancement or histogram equalisation later.
>
> AIUI opening a jpeg and saving it again at the *same* compression level
> generates the same result. Repeating it several times at *varying*
> compression levels will degrade the result. Or repeatedly editing the
> picture and then saving/reopening will also degrade the result.

Not quite true. Most of the damage is done on the first iteration. And
if you do nothing at all but only load and resave at *exactly* the same
quality settings the result will only very slowly drift away from the
original and blocks well settle on a self consistent attractor nearby.

In other words a similar looking image which when encoded as JPEG and
decoded again gives an image with exactly the same JPEG coefficients.

But as soon as you change the quality settings or make a global change
(constrast or brightness) all bets are off. A new set of quatisantion
losses will cause additional significant losses on the save. It is a
good idea to save work in progress in a (native) lossless format.

Example of generational JPEG losses on a pathological test case at:
http://www.nezumi.demon.co.uk/photo/jpeg/2/jpeg2.htm

Regards,
Martin Brown
!