Generational loss: what happens when you save a JPEG over and over
Each JPEG re-encode rounds away a little more detail. Here is what gets lost first, where the damage stops, and why the deep-fried meme look exists.
The setup
Save a JPEG. Open it. Save it again. Open that one, save it again. Do this a hundred times in a row, at the same quality setting each time.
The 100th save will not look like the 1st save. It might be a meme that has been emailed around since 2012, a screenshot of a screenshot of a screenshot, or an artifact-laden photograph that has bounced through a dozen apps that re-compressed it without asking.
This post is about why that happens, what the predictable patterns are, and how to use the effect on purpose if you want to.
Where the loss comes from
JPEG's lossy step is quantization. The encoder converts each 8×8 pixel block into 64 frequency coefficients, divides every coefficient by an entry from a fixed quantization table, and rounds the result. The compression explainer walks through the math.
The crucial detail for generational loss: rounding is not invertible. If the quantization table at position (4, 4) is 56, and a coefficient was 137 before rounding, the encoder writes down round(137 / 56) = 2. On decode, the value comes back as 2 × 56 = 112. The original 137 is gone forever, replaced with 112.
The second generation starts with that 112. After the next round of DCT and quantization, it might get reconstructed as 112 still, or it might shift to 104 or 120 depending on how the surrounding pixels interact. Every generation introduces a small new rounding error on top of the previous one.
The convergence trick
Here is the surprising part: the errors do not compound forever. After many generations at the same quality setting, the image converges to a fixed point where the encode-decode cycle no longer changes it.
The intuition is that quantization snaps values to a discrete grid. After enough rounds of "decode, encode, round", the image only contains values that already sit on the grid. Re-encoding it produces the same grid values, decoding gives the same pixels, and the cycle stabilizes.
The number of generations it takes to converge depends on the quality setting and the image content. At quality 85, most natural images stabilize within 10–20 generations and look almost identical to generation 1. At quality 30, convergence happens faster (5–10 generations) but the stable state is heavily degraded. The Independent JPEG Group's libjpeg documentation discusses this convergence in its README, and academic studies have measured it for specific quantization tables.
This is why "save 100 times at quality 75" looks essentially the same as "save 30 times at quality 75". The damage stacks fast, then plateaus.
What gets lost first
The encoder is biased to throw away high-frequency information first, because the quantization table assigns larger values to high-frequency positions. Every generation, the high frequencies suffer disproportionately.
In practical terms:
- Fine texture goes first. Skin pores, fabric weave, individual leaves. These rely on high-frequency coefficients that round to zero after a few generations.
- Sharp edges grow halos. The same high-frequency rounding produces "ringing" around any high-contrast boundary. Each generation makes the halos slightly more pronounced.
- Color saturation drifts. Chroma subsampling already reduced color resolution. Each round of quantization shifts the remaining chroma values, often toward higher saturation in the dominant channels and lower saturation elsewhere. This is part of what gives deep-fried memes their oversaturated look.
- Block boundaries become visible. Each generation pushes block-edge pixels slightly further from their neighbors, and the 8×8 grid becomes a checkerboard of mismatched tones.
What survives the longest is the overall composition: rough colors, large shapes, the position of major objects. The low-frequency DC coefficients are quantized lightly and barely change between generations.
This is why old meme images are still legible even after years of resharing. The high-frequency detail is gone but the low-frequency layout is preserved.
When generational loss is intentional
A whole aesthetic exists around the look. "Deep-fried" memes deliberately push images through many low-quality JPEG saves to produce the crunchy, oversaturated, halo-ringed look that signals authentic internet circulation. The full cultural arc is covered in the deep-fried meme guide, and the technique is one of the core moves in the broader glitch art toolkit.
The JPEG Artifact Generator has a Generations slider precisely for this case. Set the quality to 65, the generations to 6, and the output looks like an image that has been shared a thousand times. Push the generations to 10 and you get the full deep-fried effect in a single export.
When it is genuinely a problem
Generational loss matters in three real situations:
- Editing workflows that re-save on every action. Some mobile photo editors re-encode the JPEG every time you tap save, even if you only changed a crop. After a dozen small edits, the file is visibly worse than where you started. The fix is to edit from a non-destructive format (RAW, lossless WebP, PNG) and export to JPEG only at the very end.
- Re-saving images you receive. If someone emails you a photo and you open it, edit it, and resave it, you have added a generation. For irreplaceable images, save edits to a new file in a lossless format rather than overwriting the JPEG.
- Photo libraries that auto-process. Apps that auto-rotate, auto-enhance, or auto-add metadata sometimes re-encode without warning. iOS Photos does not (it stores edits as a sidecar and only re-encodes on export), but many third-party photo apps do.
If you have a heavily-degraded image that matters, the removal guide covers what AI restoration models can and cannot do. They cannot undo generational loss; they can sometimes mask it.
Why the same image looks different on different services
Most major platforms re-encode every image you upload to their own preferred quality settings. Discord, Reddit, Twitter, Facebook, Instagram, WhatsApp, and Telegram all run uploaded JPEGs through their own encoders at their own quality settings. The result is that an image you uploaded once at quality 95 might come back at effective quality 75 (Discord), 60 (Telegram), or 45 (WhatsApp on mobile data).
If the image is then re-uploaded somewhere else, the second platform sees the already-degraded version and applies its own re-encoding on top. After three or four hops, the visible damage from social-platform re-encoding can match what would take ten or twenty manual saves at a constant quality.
This is the practical mechanism for "deep-fried" memes spreading naturally: no one is sitting at home saving the same JPEG ninety times. The platforms are doing it on every share.
What the math actually predicts
The peak signal-to-noise ratio (PSNR) of a JPEG that has gone through N generations at the same quality looks roughly like this curve for a natural photograph:
| Generation | Approximate PSNR vs original |
|---|---|
| 1 | 38–40 dB (visually identical for most viewers) |
| 5 | 35–37 dB (subtle damage in flat areas) |
| 10 | 33–35 dB (visible blocking on hard edges) |
| 25 | 31–33 dB (clearly degraded) |
| 50 | 30–32 dB (plateau, additional generations barely change anything) |
| 100 | 30–32 dB (same as 50) |
PSNR above about 40 dB is generally considered "visually lossless"; below 30 dB is "clearly damaged". The plateau around 30–32 dB after a few dozen generations is the fixed point the math predicts.
These numbers are for libjpeg at quality 75 with default 4:2:0 chroma. At higher quality settings the plateau is higher (less visible damage). At lower quality settings the plateau is lower (more damage) and is reached faster.
The Wang/Bovik SSIM paper (Wang et al., IEEE TIP 2004) is the standard reference for perceptual quality metrics on compressed images if you want to measure your own generational-loss curves more carefully.
FAQ
Does opening a JPEG cause generational loss?
No. Decoding a JPEG for display does not change the file. Only re-encoding does. If your image viewer is not saving the file, you are not losing generations.
Does cropping a JPEG cause generational loss?
If the editor re-encodes the cropped result, yes. Some specialized tools (jpegtran, ImageMagick with the -define jpeg:optimize-coding=true flag) can perform lossless cropping by editing the JPEG stream directly, but they only work on crops aligned to the 8×8 block grid (multiples of 8 pixels). Most editors do not bother and just re-encode normally.
Will the loss eventually stop?
Yes. After enough generations at a fixed quality, the image hits a fixed point where re-encoding produces the same bytes. The number of generations to convergence is typically 10–50 depending on quality and content.
How can I avoid generational loss in editing?
Edit from a lossless source. Keep the original RAW or PNG, do all your edits on that, and export to JPEG only when you need to share the result. Treat every JPEG export as a one-way conversion.
Are PNG, WebP lossless, and AVIF lossless immune to generational loss?
Yes. Any lossless format encodes the exact same pixels back, so re-saving never changes the data. This is why the format comparison post recommends PNG or lossless WebP for source files you plan to keep editing.
Why do screenshots of memes look worse than the original meme?
Two reasons. First, the meme itself has usually been re-encoded several times by the platforms it passed through. Second, a screenshot tool typically captures the rendered version (after lossy decode) and saves it as a new JPEG, adding another generation on top.
Sources
- Wang, Z., Bovik, A. C., Sheikh, H. R., & Simoncelli, E. P. (2004). Image quality assessment: from error visibility to structural similarity. IEEE Transactions on Image Processing, 13(4), 600–612. The SSIM reference.
- Wallace, G. K. (1991). The JPEG Still Picture Compression Standard. Communications of the ACM, 34(4), 30–44.
- Independent JPEG Group (libjpeg) documentation, which discusses generational stability in the README.
- jpegtran, the standard tool for lossless JPEG operations (rotation, cropping on 8×8 boundaries).