Ordered Dithering | GlitchNodes
Clean Bayer dithering, plus animated patterns
- images
- image
OrderedDithering is the precision sibling of DitherMe. Where DitherMe throws thirty-plus algorithms at you, this node does ordered (Bayer-matrix) dithering properly - clean, predictable, mathematical - and then adds two modes the other one lacks: artistic patterns and a full animated mode. If you want exact control over the dither matrix and a look you can reproduce frame-for-frame, this is the one.
The mechanism is classic Bayer thresholding. It builds a Bayer matrix (2x2, 4x4, or 8x8 - the source ships them hardcoded), tiles it across the image, and uses it as a spatially-varying threshold to quantize each pixel to one of num_colors levels. Because the matrix is deterministic, the pattern is perfectly regular - no error-diffusion smearing, just that crisp "computer graphics" texture. The scale parameter (1–8) enlarges the base pattern for a chunkier look, and pattern_contrast boosts how strongly the pattern shows.
The inputs that matter
- dither_type -
Standard(Bayer),Artistic(dot/line/diagonal variations), orAnimated. Standard is the faithful one; Artistic generates decorative patterns; Animated adds temporal offset so the dither moves over frames. - color_mode -
ColororGrayscale. - num_colors (2–256, default 2) - quantization levels. 2 is stark black/white; 8–16 starts to look like a limited-color console.
- pattern_size - 2x2, 4x4, or 8x8 Bayer matrix. 8x8 gives the finest, most film-like grain.
- scale (1–8) - enlarges the pattern. Crank this for a bold, visible texture.
- frames (1–300, default 60), speed (0–1), wave_speed (0.1–2) - the Animated-mode controls.
framesis how many output frames you get;speedshifts the pattern offset per frame, andwave_speedadds a traveling wave modulation. - invert - flips dark/light and the pattern polarity. Optional
seedfor reproducible animated variations.
Output is image (IMAGE) → PreviewImage/SaveImage; feed the animated frames to a video encoder for a dither-wave loop.
Installing it
In the GlitchNodes pack:
cd ComfyUI/custom_nodes
git clone https://github.com/pxl-pshr/GlitchNodes
# restart ComfyUI
or ComfyUI Manager → Install Custom Nodes → search "GlitchNodes". Deps: numpy, torch, Pillow, opencv-python, scipy. No models.
Gotchas
The trap here is num_colors combined with pattern_size: with 256 colors and an 8x8 matrix, the dither is nearly invisible and people assume it's broken. If you want to see the effect, start at 2–8 colors with a 4x4 or 8x8 matrix - the texture is the point. In Animated mode, remember frames is the output count: set it to how many frames your video actually needs, or you'll generate a stack of stills you have to trim. And one thing to know about the animation: it's temporal dithering with pattern offsets, so without a downstream frame-rate-matched encoder it can look like strobing - that's the dithering, not a bug.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| dither_type | COMBO | 3 options: Standard, Artistic, Animated | |
| color_mode | COMBO | 2 options: Color, Grayscale | |
| num_colors | INT | 22–256 | — |
| pattern_size | COMBO | 3 options: 2x2, 4x4, 8x8 | |
| scale | INT | 11–8 | — |
| pattern_contrast | FLOAT | 1.00.1–2 | — |
| frames | INT | 601–300 | — |
| speed | FLOAT | 0.00–1 | — |
| wave_speed | FLOAT | 1.00.1–2 | — |
| invert | BOOLEAN | false | — |
| seedopt | INT | 00–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |