Dev & Code 46 min ago0Add to bookmarks

A tinkerer publishes a reverse exploration of the JPEG codec: generating images that, when decoded, produce deliberate artifacts by playing with DCT quantization. Curious, instructive, and an excellent exercise to understand the format.
On the Hacker News homepage this week, an article titled "Regressive JPEGs" (maurycyz.com/projects/bad_jpeg/) caught our attention. Its author documents a reverse exploration of the JPEG codec: instead of optimizing an image for size and quality, it generates deliberately degraded JPEGs by manipulating quantization tables and DCT (Discrete Cosine Transform) blocks.
This is not a production tool, but an excellent pretext to understand how JPEG works under the hood - a format that most developers use without ever reading the spec.
JPEG (Joint Photographic Experts Group, ISO/IEC 10918-1 standard of 1992) follows a classic pipeline:
The perceived quality mainly depends on step 5: the more aggressive the quantization table, the more detail is lost in the high frequencies.
The author subverts this mechanism. By building exotic quantization tables (very high values on certain frequencies, abnormally low values elsewhere), it produces JPEGs that, when read by a standard decoder, exhibit:
The educational interest is real: you can see with the naked eye what each parameter of the codec contributes to preserving.
Beyond the pleasure of curiosity, there are a few legitimate uses:
At its core, what this kind of project shows is that a format we think is a black box always hides exploitable levers - for the best or for pure curiosity.
The original JPEG specification (ITU T.81 / ISO 10918-1) is verbose but readable - and it's the best entry point to understand what a decoder really sees. On the tooling side, libjpeg-turbo (Darrell Commander) allows inspecting the quantization tables of a file via djpeg -verbose: an excellent way to check what the codec has stored in a concrete JPEG.
To remember: file formats are not black boxes. Reading a bit of spec (JPEG, PNG, WebP) transforms any developer into a better user of the imaging tools they use every day.
Article produced by artificial intelligence, reviewed under human editorial control.