Pixelate
Real color-quantized pixel art, not a blur-and-shrink trick
- images
- mask
- images
- mask
Downscale-then-upscale gives you a blurry mosaic, not pixel art. Real pixel art has a limited, deliberate color palette, and that's the part a naive resize can't fake. Pixelate does the actual job: it quantizes your image's colors down to a chosen count using k-means clustering, with optional dithering to fake extra perceived color depth, so the result actually reads as pixel art instead of a soft, blocky JPEG.
How it works
K-means clustering finds the N colors that best represent your image, then remaps every pixel to its nearest cluster color - that's the num_colors step. pixelation_size controls how chunky the simulated pixels come out: it's the size of each faux-pixel block, so a bigger value means bigger, blockier squares and a lower-resolution look, while a smaller value keeps more detail. init_mode controls how the k-means clustering gets seeded: k-means++ is the smart default that spreads initial cluster centers out for a more representative, consistent palette; random seeds arbitrarily and can give a different result run to run; none skips smart seeding entirely.
Dithering (dither on, plus a dither_mode) is what saves flat-color images from looking banded once you've dropped to a small palette. FloydSteinberg error-diffusion dithering gives an organic, scattered look - the classic choice for stills. Ordered dithering uses a fixed, repeating pattern instead, which matters a lot for animation: error-diffusion dithers each frame independently, so the noise pattern doesn't hold still between frames and can flicker in video; ordered dithering's fixed pattern is far more temporally stable.
The inputs and outputs that matter
images- your source image or batch.pixelation_size(16–480, default 164) - block size for the pixelation effect; smaller for finer detail, larger for a chunkier retro look.num_colors(2–256, default 16) - palette size after quantization. Lower is more limited/retro; higher stays closer to the source.init_mode-k-means++,random, ornonefor seeding the color clusters.dither/dither_mode- turn dithering on or off, and pickFloydSteinberg(organic, best for stills) orOrdered(stable across frames, best for animation).mask(optional) - for alpha-aware processing on transparent PNGs, so transparent regions don't skew the palette.
Outputs: images (the pixelated result) and mask.
How to install it
Search "Link Comfy Nodes" in ComfyUI Manager and install from there. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/Mister-Link/link-comfy-nodes
pip install -r link-comfy-nodes/requirements.txt
Restart ComfyUI. No extra model downloads for this one.
Common issues & troubleshooting
Banding on flat regions. If large flat-color areas look jarring or posterized, turn dither on before touching anything else - that's exactly the problem dithering solves.
Flicker across an animated batch. If you're pixelating video frames and seeing shimmer between frames, that's FloydSteinberg dithering being recomputed independently per frame. Switch to Ordered mode for anything animated - it costs a bit of the organic texture but buys temporal stability.
Muddy or inconsistent results on complex images. random init mode can give an uneven palette on busy, high-detail source images since it isn't seeding clusters intelligently. Switch to k-means++ (the sensible default) if quality looks off, especially at low num_colors.
Very low num_colors on photographic content. Dropping below roughly 8-16 colors on anything that isn't already simple/flat art tends to lose recognizable detail regardless of dithering - this node can only work with the colors it's given.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| pixelation_size | INT | 16416–480 | — |
| num_colors | INT | 162–256 | — |
| init_mode | COMBO | 3 options: k-means++, random, none | |
| dither | COMBO | 2 options: False, True | |
| dither_mode | COMBO | 2 options: FloydSteinberg, Ordered | |
| maskopt | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| mask | MASK | — |