The LabCOMPRESSION DETECTIVE IMAGES

FIND WHAT THE IMAGE LOST

Smaller file. Something had to go.

Drag the quality down and watch a photo shrink. Then find out exactly what a JPEG throws away to get there.

70

Ready.

HOW IT WORKS · FOR THE TILE IN YOUR MAGNIFIER

Four steps, one tile.

STEP 1 OF 4

See the exact numbers for this tile for the curious
THE ORDER THE AMOUNTS ARE STORED (ZIG-ZAG)

WHAT’S HAPPENING

Read the evidence.

HOW SMALL CAN YOU GO?

File size at every quality.

Each point is a fresh run of the model on this picture. Above about 90 the file grows fast while the picture barely improves.

TRY THIS

Three cases to crack.

  1. Small file nobody notices

    Countryside picture. Get it under 8 KB while it still looks the same.

    Not started

    Hint

    Somewhere between 85 and 95. Use the arrow keys on the slider for single steps and watch “How it looks”.

  2. Find a costly tile

    At quality 50, move the magnifier onto a tile that keeps 15 or more of its 64 patterns.

    Not started

    Hint

    Smooth sky keeps one or two. Look where dark meets light sharply.

  3. Squeeze the noise

    Get the pure-noise picture under 8 KB, then look at what it turned into.

    Not started

    Hint

    It takes a very low quality. Compare with what the countryside costs.

Starting a case loads its picture and settings.

How the model works

1. Tiles (blocks). The picture is 192 × 192 grey pixels, cut into 8 × 8 tiles. The lab’s model handles 64 × 64 pixels at a time, so the picture is processed as 3 × 3 pieces of 64 × 64 by the same model and stitched back together.

2. Patterns (DCT). Each tile is rewritten as 64 amounts, one per cosine pattern. This step loses nothing: the patterns can rebuild the tile exactly. The first amount is the tile’s average brightness; the rest describe detail from coarse to fine.

3. Rounding (quantisation). Each amount is divided by a step and rounded: level = round(amount ÷ step), with step = q × (1 + 0.15 × (across + down)) and q = max(1, round((101 − quality) × 0.8)). Fine patterns get bigger steps, so they are the first to round to zero. This is the only lossy step.

4. Rebuild (inverse DCT). Each level is multiplied back by its step and the patterns are added up.

File size. Levels are stored coarse-first in zig-zag order, so zeros bunch up at the end and one short “stop” code (end-of-block) covers them. We count the bits a baseline JPEG encoder would write for these exact levels with the standard brightness Huffman tables (ITU-T T.81, Annex K): headers excluded. KB here means 1,000 bytes; the original is 192 × 192 = 36,864 bytes.

How it looks. Based on PSNR (10 · log₁₀(255² ÷ mean squared error)): 38 dB or more “looks the same”, 32–38 “small flaws”, 27–32 “visibly worse”, below 27 “badly damaged”. These are common rules of thumb, not a vision test.

Honest limits
  • Grey only. Real JPEGs also store colour, usually at half resolution, which saves more and adds its own smearing around coloured edges.
  • The rounding steps come from this lab’s simple formula, not the standard JPEG table, so “quality 70” here is not the same as quality 70 in Photoshop or your phone.
  • The size counts the stored pattern data only. Real files add a few hundred bytes of headers. Each 64 × 64 piece restarts its brightness prediction, which costs a few extra bits.
  • Your photo is cropped to a centred square and shrunk to 192 × 192 grey in your browser. It is never uploaded anywhere.
  • The “How it looks” label is a number-based guess. Blocking in a smooth sky can look worse than a bigger error hidden in grass.
  • The 3D heights use a square-root scale so that small amounts are visible. Use the Numbers view for exact values.
Sources & further reading
  • JPEG overview (Joint Photographic Experts Group)
  • ITU-T T.81: the JPEG specification: DCT (A.3.3), zig-zag order (Figure 5), Huffman tables K.3 and K.5 used for the size.
  • G. K. Wallace, “The JPEG still picture compression standard”, Communications of the ACM, 1991.

Model notes: RESEARCH.md. Related labs: Color & Vision Lab and Inside a Camera.