Halftone Rendering
How do you create the illusion of gray using only black and white? Halftoning trades spatial resolution for tonal resolution — varying the size or density of dots to simulate continuous shading. Hover over the result to see the magnified dots.
How it works
Halftoning is one of the oldest problems in printing. A printing press can either deposit ink or not at any given point — there are no intermediate shades. Yet newspapers, books, and magazines appear to show smooth gradients and photographs. The trick is halftoning: converting continuous-tone images into patterns of dots that, from a distance, blend together to simulate shading.
Ordered dithering uses a threshold matrix (the Bayer matrix) to decide whether each pixel should be black or white. The matrix tiles across the image, creating a regular pattern. Larger matrices produce more tonal levels but coarser patterns. A 2×2 matrix gives 5 distinct levels; an 8×8 gives 65. The pattern is deterministic and fast to compute — this was widely used in early computer graphics.
Floyd-Steinberg error diffusion takes a fundamentally different approach. For each pixel, it thresholds to black or white, then distributes the quantization error to neighboring pixels that haven’t been processed yet. This produces a more organic, noise-like pattern that avoids the regular grid artifacts of ordered dithering. The quality is higher, but the algorithm is sequential — each pixel depends on its predecessors.
CMYK dot halftoning simulates what actual printing presses do: place round dots at regular intervals on an angled screen. Darker areas get larger dots; lighter areas get smaller ones. The screen angle prevents moiré patterns when multiple color channels are overlaid. In actual CMYK printing, each ink color (cyan, magenta, yellow, black) uses a different screen angle to avoid interference patterns. Here we simulate the single-color (black) version.