Lab / 03

JPEG Compression Visualizer

An interactive baseline JPEG encoder for understanding what compression does to an image, one block at a time.

JPEG Compression Visualizer showing the transform stage, a coefficient heatmap and the selected cosine basis
The discrete cosine transform stage in the original visualizer.
Field
Image processing
Platform
Browser · TypeScript · Baseline JPEG
Status
Live demo

Engineering notes

Make each intermediate step visible

The pipeline starts with colour conversion and 8 × 8 blocks, then exposes the discrete cosine transform, quantization, zig-zag ordering and entropy coding. The quality control re-encodes the image so the inspected values change with the output.

Use the same values for the interface and the file

A first pass collects coefficients and symbol frequencies. A second pass writes the JPEG using Huffman tables derived from those frequencies. The inspector reads the same data that the encoder uses, all inside the browser.

Check the bytes with a separate decoder

The project includes round-trip tests using jpeg-js. The file inspector also exposes the marker segments so visitors can trace how the tables and compressed data are laid out.