/jpeg-sandbox

Interactively edit individual DCT blocks in any JPEG image in the browser.

Primary LanguageJavaScriptMIT LicenseMIT

JPEG Sandbox

This is a very barebones editor that supports clicking on any pixel in a JPEG image to see the 64 DCT coefficients that make up that 8x8 block. Each individual coefficient can be edited through text. You can also use the slider to zero out coefficients one by one starting with the lowest absolute value (which is what you'd do during compression) or reverse that to see what it would look like to throw away the most important coefficients first.

Edit it on Glitch here: https://glitch.com/edit/#!/jpeg-sandbox

jpeg-sandbox

It also visualizes the coefficients that make up each individual block in order of their weight.

jpeg-sandbox2

I created this to help with explaining how JPEG works for a talk at CodeBar 2022.

Cat picture by Mikhail Vasilyev. Also inspired by the visualization in https://www.jezzamon.com/fourier/.

See also my Unraveling the JPEG article.

Local setup

Run yarn to install dependencies and yarn dev to run. Run the app on localhost:3000.