Lossy Image Compression Build-Up
December 18, 2024 10:41 AM Subscribe
How many times can you re-save a JPG on the highest quality setting before image deterioration from the lossy compression becomes noticeable?
There's a lot of leeway in "noticeable". As a graphic designer and photographer, I'd probably notice degradation before many people. It would depend on how much compression is used, as well as what size the image is viewed at.
posted by jonathanhughes at 11:28 AM on December 18, 2024 [2 favorites]
posted by jonathanhughes at 11:28 AM on December 18, 2024 [2 favorites]
It would depend on the image, too--if you were looking at, let's say, a rectangle made up entirely of black pixels, you could re-save that thing all day long and never see a difference.
posted by box at 11:58 AM on December 18, 2024 [3 favorites]
posted by box at 11:58 AM on December 18, 2024 [3 favorites]
Best answer: It depends on which jpeg version is in question. It's obsolete now but versions of up through jpeg2000 (and maybe later) gave artifacts essentially the same as Gibbs ringing, where you'd see ghosts of sharp lines. This was considered tolerable because the format was designed to compress photographs, not e.g. black squares on white backgrounds. Here is an example of that from a research paper. I am not certain but I believe this kind of artifact could be amplified through repeated compression, if a jpeg was sent to png and compressed to jpeg, because the first pass introduces additional sharp barriers.
One way that subsequent compression can mess with things is when it's not the same image that's repeatedly compressed, but when compression is applied to slightly different images of the same content. This is what happens sometimes when you see a post on Facebook that is an image from reddit of a tumblr of a tweet. Nobody is compressing the same exact image repeatedly, but the same "first pass" loss can occur repeatedly. Quoting from the SE link above "Given optimal conditions, recompressing a JPEG with the same quality settings would result in the exact same JPEG. In other words, recompressing JPEGs is potentially lossless. In practice, recompressing JPEGs is not lossless, "
. Emphasis added. The worst jpeg artifacts I see in the wile are as I describe above, and very far from optimal situations. The result that is blurred to hell is not what the first person saw when they found it on twitter.
posted by SaltySalticid at 12:05 PM on December 18, 2024 [2 favorites]
One way that subsequent compression can mess with things is when it's not the same image that's repeatedly compressed, but when compression is applied to slightly different images of the same content. This is what happens sometimes when you see a post on Facebook that is an image from reddit of a tumblr of a tweet. Nobody is compressing the same exact image repeatedly, but the same "first pass" loss can occur repeatedly. Quoting from the SE link above "Given optimal conditions, recompressing a JPEG with the same quality settings would result in the exact same JPEG. In other words, recompressing JPEGs is potentially lossless. In practice, recompressing JPEGs is not lossless, "
. Emphasis added. The worst jpeg artifacts I see in the wile are as I describe above, and very far from optimal situations. The result that is blurred to hell is not what the first person saw when they found it on twitter.
posted by SaltySalticid at 12:05 PM on December 18, 2024 [2 favorites]
Yeah, I'm running some simple experiments recompressing JPEGs and it doesn't seem to affect quality all that much after even hundreds of iterations. That "deep fried meme" look is mostly from upping the contrast, brightness, and saturation of an image. I found this tool that you can play around with for that effect: https://www.deepfriedmemes.com/
posted by AlSweigart at 7:26 PM on December 18, 2024 [1 favorite]
posted by AlSweigart at 7:26 PM on December 18, 2024 [1 favorite]
>
is a completely different algorithm. You're very unlikely to see a jp2 in the wild unless you work with aerial photography. Most browsers don't support them
(A shame, because they do some things that would really help browsers work better)
posted by scruss at 7:10 PM on December 19, 2024
jpeg2000
is a completely different algorithm. You're very unlikely to see a jp2 in the wild unless you work with aerial photography. Most browsers don't support them
(A shame, because they do some things that would really help browsers work better)
posted by scruss at 7:10 PM on December 19, 2024
The answer depends on the image and the viewer.
For instance, this image - tiletest.png - is made up of 7×7 alternating solid-colour tiles. JPEG uses 8×8 tiles for its colour components, so this will cause obvious ringing. And indeed, compressing it at 100% ("lossless") just once, you get the rather nasty best.jpg
Re-encoding this file over and over at 100% seems to cause a cycle of files reducing in quality, which then create a file identical to a previous generation file, and the cycle starts over again. This is the smallest file of 1000 runs, and therefore likely the worst quality: tiletest0084.jpg
(I really didn't expect this result at all)
posted by scruss at 7:58 PM on December 19, 2024
For instance, this image - tiletest.png - is made up of 7×7 alternating solid-colour tiles. JPEG uses 8×8 tiles for its colour components, so this will cause obvious ringing. And indeed, compressing it at 100% ("lossless") just once, you get the rather nasty best.jpg
Re-encoding this file over and over at 100% seems to cause a cycle of files reducing in quality, which then create a file identical to a previous generation file, and the cycle starts over again. This is the smallest file of 1000 runs, and therefore likely the worst quality: tiletest0084.jpg
(I really didn't expect this result at all)
posted by scruss at 7:58 PM on December 19, 2024
Are you specifically interested in JPEG? If not, here's an experiment.
posted by novalis_dt at 3:44 PM on December 20, 2024
posted by novalis_dt at 3:44 PM on December 20, 2024
« Older 5 Sense Stocking Stuffer Ideas - Sound! | What are some PC games like Little Gator Game? Newer »
You are not logged in, either login or create an account to post comments
posted by alex1965 at 11:03 AM on December 18, 2024 [3 favorites]