Saramsha

No. 026  ·  12 October 2026

What the Eye Never Missed

A photograph, to a JPEG encoder, is secretly built from 64 fixed wave patterns repeated over every 8×8 tile of pixels. Drag the quality slider down and watch it throw away the patterns your eye would never notice losing — until it runs out of ones that don't matter, and the blocks start to show.

kept at this quality rounded away to zero

one block, original

same block, after compression

Click anywhere on the boat above to inspect that 8×8 tile.

About this piece

A photograph is a sum of ripples

Cut any 8×8 tile out of a photograph and, pixel by pixel, it just looks like 64 numbers with no particular structure. But there is a different, equivalent way to write those same 64 numbers: as a weighted sum of 64 fixed wave patterns, each one a cosine ripple that gets faster toward the bottom-right of the grid above. The top-left pattern is flat — it just says how bright the whole tile is on average. One step right adds a single slow ripple left-to-right; one step down adds the same ripple top-to-bottom; the corner opposite the flat one is the fastest possible checkerboard a tile this size can hold. This rewriting is called the discrete cosine transform, and it is exact — transform a tile and transform it back with no rounding, and you get the original pixels to the last decimal.

What makes it useful is that ordinary photographs are made mostly of slow change — skies, skin, walls, the sea — so almost all of the energy in a typical tile lands on the patterns near the flat corner, and the fast-ripple patterns near the far corner are already close to zero before anyone throws anything away. JPEG's actual trick is to round each of the 64 numbers to the nearest multiple of a step size, and to make that step size much larger for the fast patterns than the slow ones. A number that was small to begin with rounds straight down to zero. Lower the quality slider and every step size grows, in a fixed pattern baked into the standard since 1992, and whatever best-selling the file can afford must survive that rounding or it doesn't survive at all. The grid above you is showing exactly that rounding, tile by tile, pattern by pattern.

Why the blocks show up

Once nearly every fast pattern in a tile has rounded to zero, what's left in that tile is something close to a single flat shade with a little slow ripple — and the tile next to it rounded independently, with no promise of matching at the seam. Stack enough of those side by side and the seams themselves become visible: the famous blocky look of an over-compressed JPEG is not a separate kind of damage, it's the discrete cosine transform running out of patterns to describe the edge with.

Why colour goes first

This page can degrade brightness and colour independently because JPEG stores them separately — not as red, green and blue, but as one brightness channel (Y) and two colour-difference channels (Cb, Cr) borrowed straight from colour television. Human vision resolves fine brightness detail far better than fine colour detail: the retina has roughly four times as many brightness-sensing rods and cones devoted to it as to colour, a mismatch photography has exploited since the first colour TV broadcasts split the signal the same way. The JPEG standard's own quantization table takes advantage of it directly — the default colour table starts rounding away detail several times coarser than the brightness table does, at every quality setting. Switch this page to Colour only and lower the slider all the way, and the boat barely changes; switch to Brightness only at the same setting and it falls apart. That asymmetry, not a flaw, is most of where a JPEG's compression actually comes from.

This page implements the real transform, the real standard quantization tables (ISO/IEC 10918-1 Annex K) and the real quality-to-scale formula libjpeg has used since 1991, on the actual pixels of the boat above — nothing here is faked for effect. It skips two things a production encoder adds afterward: Huffman-coding the surviving numbers (the size readout is a coefficient count, not a byte count) and subsampling the colour channels to a lower resolution before any of this even starts, which is where a further, separate saving comes from.