No.258 · Media
Dither Portrait
A picture printed in two inks by error diffusion; a lens follows the pointer and shows the full-colour original, its edge breaking into dots.
The prompt
Written for the variant you picked above: Ink on paper
Build an image component that prints a picture in exactly two inks and lets a lens reveal the original. Draw the source (an image URL, or by default a generated horizon study painted on canvas) cover-fitted into the frame; sample it at one cell per 2 CSS px, convert to luma with a slight gamma lift, and dither it: Floyd–Steinberg error diffusion by default (serpentine scan, 7/16 · 3/16 · 5/16 · 1/16), with Atkinson (six neighbours at 1/8 each, so highlights stay open) and an 8×8 Bayer ordered matrix as alternatives. Write the 0/1 mask into a small canvas in the ink and paper colours and draw it up with image smoothing off, so every cell stays a crisp square. A round lens (radius 110px, or 30% of the frame on small screens) follows the pointer on a 0.22 lerp and grows in on enter and shrinks away on leave. Inside it the full-colour original shows through; across a 52px feathered edge each cell shows colour only where the radial falloff beats that cell's Bayer threshold, so the boundary breaks into the same kind of dots instead of a hard circle. The edge mask is rebuilt only for the cells around the lens. A pill button in the corner cycles the dither pattern and re-prints the picture. Selected variant — Ink on paper: Ink #1b1a17 on paper #efe9dc, like a risograph print.
Notes
- Interaction
- Move over the picture to reveal colour under the lens; click the pill to switch between Floyd–Steinberg, Atkinson and Bayer.
- Motion
- Lens position lerp 0.22 and radius lerp 0.18; the loop stops once the lens settles.
- Accessibility
- The canvas has role="img" and a written description. The pattern button is a real button whose label names the current pattern. Reduced motion moves the lens directly.
- Responsive
- Re-prints at the new size on resize; the lens caps at 30% of the smaller side.
- On touch
- Tap or drag to place the lens; vertical swipes still scroll.