Nodes/GlitchNodes/Ordered Dithering | GlitchNodes
ComfyUI Node

Ordered Dithering | GlitchNodes

Clean Bayer dithering, plus animated patterns

By pxl-pshr·Created 2 years ago·Updated 3 months ago· 73
Ordered Dithering | GlitchNodes
  • images
  • image
dither_type
color_mode
num_colors2
pattern_size
scale1
pattern_contrast1.0
frames60
speed0.0
wave_speed1.0
invertfalse
seed0

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), or Animated. Standard is the faithful one; Artistic generates decorative patterns; Animated adds temporal offset so the dither moves over frames.
  • color_mode - Color or Grayscale.
  • 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. frames is how many output frames you get; speed shifts the pattern offset per frame, and wave_speed adds a traveling wave modulation.
  • invert - flips dark/light and the pattern polarity. Optional seed for 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.

CategoryGlitchNodes

Inputs (12)

NameTypeDefaultDescription
imagesIMAGE
dither_typeCOMBO3 options: Standard, Artistic, Animated
color_modeCOMBO2 options: Color, Grayscale
num_colorsINT22–256
pattern_sizeCOMBO3 options: 2x2, 4x4, 8x8
scaleINT11–8
pattern_contrastFLOAT1.00.1–2
framesINT601–300
speedFLOAT0.00–1
wave_speedFLOAT1.00.1–2
invertBOOLEANfalse
seedoptINT00–18446744073709550000

Outputs (1)

NameTypeDescription
imageIMAGE