Imgix APIsRendering APIStylizeThreshold Dither

Threshold Dither

threshold-dither

The threshold-dither parameter replaces the hard cutoff of threshold with a dot pattern that approximates the midtones. The output is still pure black and white, but the pattern’s density stands in for the shades that a hard cut would discard.

threshold-dither requires threshold. On its own it produces no dithering.

ValueAlgorithm
floydsteinberg (or true)Floyd–Steinberg error diffusion, the familiar fine-grained dither
atkinsonAtkinson error diffusion, which keeps more contrast and leaves cleaner highlights

A threshold of 50 gives the classic dithered look. Non-numeric or unrecognized values are ignored and left out of the X-Imgix-Params response header.

threshold=50 with no dithering
sandbox-demo
threshold-dither=floydsteinberg recovers the midtones
sandbox-demo

Atkinson leaves cleaner highlights at the same cutoff.

threshold-dither=atkinson at threshold=50
sandbox-demo

Pattern Size

The dot pattern is generated at the output size, not the source size. Changing w, h or dpr therefore changes the pattern, not just its scale. Two renders of the same image at different widths will not have matching dots, which matters when a dithered asset is served through a srcset.

Dithered output also compresses poorly in lossy formats, because the pattern is high-frequency detail. Prefer fm=png or fm=webp over JPEG for dithered images.