RC RANDOM CHAOS

Faking Print Halftones on the Web with a Single ImageMagick Command

· via Hacker News

Original source

How My Images Are Dithered

Hacker News →

A blogger walks through the technique they use to give website images a printed, halftone look, freely admitting up front that they’re not an authority on dithering and that purists may quibble over whether this even qualifies. The effect imitates amplitude-modulated (AM) print screening, where darker regions are rendered as larger dots arranged in a predictable grid, as opposed to frequency-modulated (FM) screening’s scattered dots. To avoid Moiré interference, real AM printing offsets each color channel by a set angle per DIN 16547 — the post reproduces this by splitting an image into CMYK channels and rotating each one (0°, 15°, 45°, 75°) before recombining.

The whole thing runs as one chained ImageMagick convert command: resize to 800px wide, convert to CMYK, separate channels, tile a 2x2 dot pattern with a Gaussian filter, distort/rotate each channel, then Overlay-composite them back together. A follow-up realization improves the illusion by adding -colors 2 so each channel is reduced to true two-level dots of varying size rather than smoothly varying darkness — closer to how ink actually behaves on paper. The author also documents an older variant that flattened the result to monochrome black-and-pink.

Notably, the post pushes back on the common assumption that dithering is about shrinking files. While the technique can reduce size by cutting colors — the reason sites like Low-Tech Magazine use it — this particular approach is framed purely as an aesthetic experiment and may even enlarge some files. The piece is a light, self-deprecating look at recreating a print artifact in the browser, with all the code included for anyone who wants to copy it.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.