Pixel Grid: Median Fixer
The node that turns AI pixel-art mush into clean, solid blocks
- image
- downscaled_image
- original_size_image
If you've ever generated "pixel art" with a diffusion model, you already know the problem: it doesn't actually draw pixels. It paints mush. Edges go soft, shading bleeds across block boundaries, and what should be one crisp 6x6 block of a single color is really 36 slightly different colors pretending to be one. Median Fixer is the marquee node of the Pixel Grid Helpers pack - it's the one the author built first, and the one that actually gets cited when pixel-art workflows come up in the wild. It exists to fix exactly that mess.
The idea is refreshingly pragmatic. Instead of fighting the model to output clean pixel art, you let it do its usual blurry thing - where each "logical pixel" is a fixed-size block, say 6x6 real pixels - and then you clean it up after the fact. The node cuts the image into a grid of grid_size × grid_size blocks, computes the median color of every block, and repaints the whole block with that single color. Median rather than mean, and that choice matters: a few stray noise pixels - a highlight here, a dark smudge there - barely move a median, while they'd yank a mean around. Outliers get ignored instead of rewarded.
Inputs: image, and grid_size (1–128, default 6). grid_size should match the size of your logical pixels, so if your source was upscaled 8x, set it to 8. The one gotcha worth knowing: the node silently trims the right and bottom edges so the dimensions divide evenly by grid_size. A 130x130 image at grid 6 becomes 126x126. If your blocks are exactly aligned this never bites you; if they're not, you'll see a thin strip vanish on two sides.
Outputs:
downscaled_image- the image at true pixel-art resolution, one pixel per block. This is the interesting one: it's what the art actually is, freed of all the upscaling noise. Save it, feed it to an img2img pass, or scale it back up yourself with a pixel-art-friendly scaler.original_size_image- the same result nearest-neighbor upscaled back to (cropped) full size. Same ballpark dimensions you put in, now with solid, clean blocks.
Both are plain IMAGE tensors, batch-aware, and they drop straight into Save Image or Preview Image.
Install is the pack standard: ComfyUI Manager → search "Pixel Grid Helpers" → install, restart ComfyUI, refresh the browser. Or git clone https://github.com/molbal/ComfyUI-PixelGridHelpers.git into your custom_nodes folder. There are no models to download and no extra Python packages - this is plain torch tensor math, which is why install is genuinely painless.
Where people get burned: mismatched grid_size. Set 6 when your logical pixels are really 4x4 and you get a checkerboard mess, not a fix. Count your block size before you set it - a 768px image made from a 128px source is 6x, a 512px source upscaled to 1024 is 2x. And remember the edge trim: if your dimensions aren't clean multiples, the output won't match the input size, so pre-crop if it matters. For animations, the author's own suggestion is to run this per frame - it's the cleanup step that makes AI-generated pixel-art animations stop shimmering and start looking deliberate.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| grid_size | INT | 61–128 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| downscaled_image | IMAGE | — |
| original_size_image | IMAGE | — |