Nodes/ComfyUI/Quantize Image
ComfyUI Node Runs on cloud

Quantize Image

Posterize anything into a retro palette

By Comfy-Org·Created 4 years ago·Updated 35 minutes ago· 129,939
Quantize Image
  • image
  • IMAGE
colors256
dither

Sometimes you don't want 16 million colors. ImageQuantize ("Quantize Image") reduces an image to a chosen palette size - anywhere from 1 to 256 colors - with optional dithering to hide the banding. It's been in core since April 2023 (it originally shipped under the name "Dither" before being renamed), and it's the node for every posterized, pixel-art, retro, or "limited palette" look, plus a few genuinely practical uses people forget about.

What it's for

  • The graphic/poster look. Push colors down to 16–64 with no dither and you get hard, posterized bands - the comic-book / screen-print aesthetic that reads as intentionally stylized rather than broken.
  • Retro pixel-art and Game Boy vibes. Crank colors to 4–8 and add a bayer dither and you're firmly in chunky-console territory.
  • Palette prep for downstream work. Reduce to 32–128 colors before feeding an image into a model or a tracing/vector pass, and you've simplified the target. Same trick people use before converting to a limited ink palette.
  • File-size sanity. A quantized PNG is dramatically smaller than a full-color one. Not the main use, but real.

How it works

Under the hood it's Pillow's quantize: build a colors-entry palette from the image, then map every pixel to its nearest palette entry. The dither dropdown decides how the rounding error gets handled:

  • none - hard mapping, maximal banding. This is the intended graphic look, not a bug.
  • floyd-steinberg - the classic error-diffusion dither. The pixel's rounding error is scattered to its neighbors, which eliminates most banding while keeping the reduced palette. This is what you want when you care about showing the image, not the style.
  • bayer-2 / 4 / 8 / 16 - ordered dithering with a Bayer matrix at increasing resolution. Gives that characteristic crosshatch/grid grain (think Game Boy camera, not newspaper halftone). Higher order = finer pattern.

The two inputs that matter: colors (1–256, default 256) and dither. At default 256 colors, the result is nearly indistinguishable from the input except in smooth gradients - this node only earns its keep once you actually pull colors down.

Getting it

Ships with ComfyUI core, no install - search "Quantize". Pixel-space filter, after VAE Decode.

Common gotchas

  • colors=256 + dither=none still bands. Even at the max, smooth gradients show faint banding because you've collapsed a continuous gradient to 256 discrete steps. That's the node doing exactly what you asked.
  • Dithering is not free of artifacts. Floyd-Steinberg can smear tiny speckle into clean areas; bayer leaves a grid texture. Pick by what you're trying to avoid - banding (floyd) or grid (they both trade one for the other).
  • It processes each batch frame separately. A multi-frame batch gets quantized frame by frame, which is fine for stills but means a video can get palette drift between frames. Lock the palette externally if you need frame-consistent colors.
  • It's a reduction, not a remap. There's no "artistic color count" here - it picks the best-fit palette automatically. If you want your exact palette, you'll need a custom node, not this one.

For 95% of "make this look retro / graphic / clean" needs, this is the fastest path in core ComfyUI.

Categoryimage/filters

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
colorsINT2561–256
ditherCOMBO6 options: none, floyd-steinberg, bayer-2, bayer-4, bayer-8, bayer-16

Outputs (1)

NameTypeDescription
IMAGEIMAGE