Images · component · 18K

Dither image

An <img> that turns into a crisp 1-bit dither once it scrolls into view: worker-based (Blob worker + OffscreenCanvas, main-thread fallback), HiDPI-exact dots, theme ink and paper, cached results, an optional Color/1-bit toggle and a top-down scan reveal.

Server rendering and no-JS show the plain image in the same box. Cross-origin images need CORS headers (Access-Control-Allow-Origin) plus crossOrigin="anonymous"; without them the original image stays and one warning is logged. A Content-Security-Policy must allow worker-src blob: for the worker, otherwise the work runs on the main thread in idle slices.

Install

pnpm dlx shadcn@latest add @s7ui/dither-image

Example

This example also uses @s7ui/button @s7ui/dither.

Atkinson, 2 px dots, drawn top-down.
Atkinson
Floyd–Steinberg
Bayer 4×4
Bayer 8×8
Threshold
Atkinson, contrast 1.3, sepia

Info

Files:
components/retro/dither-image.tsx
Uses:
@s7ui/theme, @s7ui/button, @s7ui/dither
Packages:
—