Skip to content

No.437 · 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

Copy this text

Automatic copying is unavailable. Copy the selected text using your device’s copy command.

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): Ink #1b1a17 on paper #efe9dc, like a risograph print. This selection takes precedence over references to other themes or options in the general brief. Implement this selected appearance; do not add a variant picker or alternative appearances unless requested. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. 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 behavior: Re-prints at the new size on resize; the lens caps at 30% of the smaller side. Touch: Tap or drag to place the lens; vertical swipes still scroll. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.

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.