Deep dive9 min · 3 Aug 2026

Why a 3 MB PNG becomes a 400 KB JPEG and looks identical

A tour of lossy compression using the only example anyone cares about: the screenshot you are trying to email.

JR

Jonas Ridder

Engineering · 3 August 2026

An eight-fold size reduction with no visible difference sounds like a trick. It is not; it is an exploitation of the gap between what a camera sensor records and what your visual system can distinguish, and the gap is enormous.

Three things JPEG throws away

First, colour resolution. Your eye is far more sensitive to changes in brightness than in hue, so JPEG stores brightness at full resolution and colour at a quarter of it. Almost nobody sees this.

Second, high-frequency detail. The image is divided into small blocks and each is described as a sum of patterns from coarse to fine. The finest patterns contribute least to what you perceive, and they are quantised away first.

Third, precision. What remains is rounded, coarsely for the fine patterns and gently for the coarse ones. This is the single step where quality is chosen, and it is what a quality slider actually controls.

Where it falls apart

Hard edges are made of exactly the high-frequency detail JPEG discards, which is why text in a JPEG grows a faint halo. On a photograph there is nothing to halo. On a screenshot of this paragraph, you would see it immediately.

Compression is not magic. It is a well-informed guess about what you were not going to look at.

A practical setting

For anything that will be looked at on a screen, quality 80 is indistinguishable from the original in side-by-side comparison and roughly a third the size of quality 100. Above 90 you are storing detail nobody will ever perceive. Below 60 you can see it.