Files
TagTinker/web-image-prep
i12bp8 ad9b6dd2fe web-image-prep: hue-aligned tri-colour quantiser + serpentine dither
The old quantiser pulled accent ink toward any chromatic pixel using a
flat chroma bonus, which smeared red across shadows and produced flat
red blobs without depth. Two fixes:

- Distance now weights L (lightness) ~1.6x more than chroma, so dark
  pixels go to black and light pixels to white before colour competes.
  That preserves the photograph's tonal structure.
- Accent attraction is the squared *signed projection* of the pixel's
  chroma onto the accent direction. Red ink only pulls red-leaning
  pixels (positive a*); blue/green never picks red. The squaring gives
  a smooth ramp, so faint reds get sparse red dither and saturated
  reds get dense red - matching how a real risograph layers a single
  chromatic ink under W/B halftones.

Also flipped Floyd-Steinberg to a serpentine scan with mirrored kernel
on reverse rows, killing the diagonal worm artefacts that gave smooth
gradients an obviously-dithered look.
2026-04-26 20:59:15 +02:00
..