ComfyUI Node

Fix Pixel Art

The pixel-art cleanup your generator won't do for you

By Wicloz·Created 2 years ago·Updated 11 months ago· 1
Fix Pixel Art
  • images
  • IMAGE
pixel_size1
palette_colors12

Ask a diffusion model for "pixel art" and you usually get the opposite: soft, anti-aliased blobs that read as pixel art from across the room and fall apart the moment you zoom in. Real pixel art has hard, uniform squares and a limited palette. Fix Pixel Art is a small post-process pass that forces your generated image into an actual grid.

It doesn't generate anything - no model, no VRAM. It takes whatever IMAGE you feed it, chews through the pixels with PIL, and hands back a crisper, chunkier version. If you generate a composition you like but the pixel look is mushy, this is the clean-up you're missing.

How it works

The source is straightforward, and the order of operations is what makes it work:

  1. Downscale the image by pixel_size using nearest-neighbor resampling.
  2. Quantize the colors down to palette_colors (PIL's MAXCOVERAGE method, with dithering off).
  3. Upscale back to the original dimensions with nearest-neighbor.

Downscale-then-upscale with nearest-neighbor is the classic way to force aligned, chunky pixels. Quantizing first collapses all the muddy in-between shades into a limited palette, so the result looks designed rather than compressed - flat color blocks instead of gradient mush. Dithering is deliberately off, which is why the colors stay clean.

Inputs and output

  • images - an IMAGE tensor. It accepts a batch and loops over every image, so a whole batch of generations gets fixed in one pass.
  • pixel_size (default 1, min 1) - how big each pixel block ends up. At 4, a 512×512 image becomes a 128×128 grid blown back up to 512, with 4px squares. At 1, no resizing happens at all.
  • palette_colors (default 12, 1–256) - the color budget. Lower is more aggressive and more "retro"; 12 is a good starting point.

The single output is the processed IMAGE. Save it or feed it into whatever comes next.

One underrated trick: set pixel_size to 1. That means no resizing, but the color quantization still runs - so you get a flat, posterized version of any image at its original resolution. It's effectively a one-click posterize filter that also works on photos, not just pixel art.

Installing it

The pack is on the Comfy Registry, so: ComfyUI Manager → search "ComfyUI Simply Nodes" → install → restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/Wicloz/ComfyUI-Simply-Nodes

There's no requirements.txt and nothing to download. It only needs PIL and numpy, both of which ship with stock ComfyUI. Because the work is plain CPU image processing, it runs in a blink and never touches your GPU.

Common issues

  • Still blurry: this node sharpens edges and limits colors, but it can't invent detail that was never rendered. Generate at the size you want to finish at, then fix up - a 512 render upscaled to 4K will just give you big, soft blocks.
  • Banding on gradients: that's the no-dither quantization working as designed. If a sky looks posterized, raise palette_colors.
  • Colors look washed or shifted: the MAXCOVERAGE palette is chosen by coverage, not by your aesthetic. If the result is off, try fewer or more colors rather than blaming the input.

For forcing a hard pixel grid on anime-style generations, this is about as frictionless as it gets. It won't make bad pixel art good, but it'll make good pixel art look like it was actually made in pixels.

Categorysd

Inputs (3)

NameTypeDefaultDescription
imagesIMAGE
pixel_sizeINT1
palette_colorsINT121–256

Outputs (1)

NameTypeDescription
IMAGEIMAGE