PixSqueeze

Fast · Private · High-Efficiency
Explainer

How image compression actually works

Most people use a quality slider without knowing what it does. Understanding it takes about ten minutes and makes every subsequent decision obvious.

Two entirely different things

Lossless compression finds redundancy and describes it more efficiently. Nothing is discarded — decompress the file and you get back exactly what went in, byte for byte. PNG works this way, as does ZIP.

Lossy compression throws information away permanently, choosing things human vision is bad at noticing. You cannot get the original back. JPEG, WebP and AVIF all work this way.

This is why a quality slider exists for JPEG but not for PNG. With lossless there is nothing to trade — there is one correct answer and the encoder either finds a smaller representation or it does not.

What lossy compression discards

Human vision has known weaknesses, and lossy formats exploit them systematically.

We are far more sensitive to brightness than to colour. So the encoder keeps luminance detail at full resolution and stores colour information at half resolution or less. You genuinely cannot see the difference in a photograph, and it removes a large fraction of the data immediately.

We are also poor at seeing fine detail in busy areas. The encoder breaks the image into blocks, converts each to frequency information, and discards the high-frequency components that describe the smallest variations. The quality slider is essentially a dial on how much of that fine detail to throw away.

Why artefacts look the way they do

Compression artefacts are not random noise; they are the shape of the algorithm showing through.

Blocking — visible squares in skies and gradients — happens when the encoder has discarded so much that adjacent blocks no longer blend. Ringing — halos around sharp edges and text — happens because a hard edge needs high-frequency information to describe, and that is exactly what was removed.

This is why text and line art suffer so badly under JPEG while photographs cope well. A photograph has soft, continuous variation. Text is nothing but hard edges.

Generation loss is real

Every time you save a lossy image, information is discarded. Save it again and the encoder is now working on the already-damaged version, treating the previous pass's artefacts as detail worth preserving.

Do this repeatedly and the image visibly degrades — this is generation loss, the same phenomenon as photocopying a photocopy. It is why you should always work from the largest, cleanest original you have rather than from something already exported for another purpose.

One compression pass from an original is fine and invisible. Five passes is not.

What this means for your settings

  • Photographs — lossy, quality 70–80. The saving is enormous and the loss is invisible.
  • Text, screenshots, line art — lossless, or lossy at high quality. These are the worst case for lossy formats.
  • Anything you will edit again — keep a lossless master and export lossy copies.
  • Already-compressed files — recompressing gains little and costs quality. Go back to the source.