Color Posterize (MD)
Flat bands of color in one click, no model required
- image
- mask
- image
Posterize is the cheapest way to make AI output stop looking like AI output. The diffusion pipeline gives you soft, continuous, full-color gradients; this node stamps each RGB channel down to a fixed number of levels, and suddenly you have hard bands of flat color - cel-shading, pop-art, graphic-design territory. It's a deterministic pixel operation that runs in milliseconds and never rolls a seed, which is exactly the class of tool the post-processing layer is supposed to be: reach for the $0 operation before you burn another generation pass trying to get a "flat vector look."
How it works
This is a straight port of GIMP's GEGL posterize. Per channel it runs a uniform quantizer - floor(x * (levels-1) + 0.5) / (levels-1) - which rounds each pixel's value to the nearest of N evenly spaced steps. Do that to R, G and B independently and gradients collapse into stair-stepped bands. It works in sRGB by default, so the effect is predictable on screen, and the alpha channel is passed through untouched if you feed it RGBA.
The two things every MdColorMod node shares are here: an optional mask input that blends the effect per-pixel (0 = untouched original, 1 = fully posterized), and batch support, so a stack of frames gets the same treatment in one run.
The inputs that matter
image- your IMAGE tensor.Color- an INT, 2 to 256, default 3. Despite the name this is levels per channel, not a color choice. 3 gives you up to 3×3×3 = 27 colors. 4–6 is the softer "graphic" range for photos; 256 is effectively a no-op.mask- optional. Restrict the effect to part of the frame, e.g. posterize the background but keep a face smooth.
The single image output is just an IMAGE, so it wires into Preview/Save like anything else, or into more color nodes downstream.
Install
It ships in the MdColorMod pack, which has zero Python dependencies - no requirements.txt to satisfy, no model files to download, just torch, which ComfyUI already has.
cd ComfyUI/custom_nodes
git clone https://github.com/MdONeilsl/ComfyUI-MdColorMod
Restart ComfyUI and the nodes appear under the md menu. Or, easier, use ComfyUI Manager and search "MdColorMod".
Where people get burned
There's no dithering here, and that's the point - but it means large flat areas can band worse than you expected at low levels. That's inherent to posterization, not a bug; if you want a dithered "fake more colors" result you'll need a separate dither step. The other classic gotcha is defaulting to 3 and calling the result ugly - on a photographic image, 3 levels per channel is aggressive. Start at 5 or 6 and step down. And don't forget Color is per-channel levels, not a final palette size; the total color count is roughly levels³, which is why small slider changes feel so big.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Input image tensor. | |
| Color | INT | 32–256 | Number of colors (levels) per channel (2-256). |
| maskopt | MASK | Optional mask to restrict the adjustment area. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | The posterized image. |