SpriteGrid

From The Hei Canon

SpriteGrid (CLI: spritegrid) turns AI-generated pixel art into real pixel art.

Stack: Python 3.12+. License: MIT. Public repo, published on PyPI.

AI image models generate pixel art at high resolution with misaligned pixels, grainy colors, and wrong resolution. SpriteGrid detects the implicit pixel grid and downsamples to clean, single-color pixel art at its true resolution.

Install

pip install spritegrid
spritegrid ai_pixelart.png -o clean_sprite.png

ComfyUI node

Ships as a ComfyUI custom node — the SpriteGrid and SpriteGrid (Animation) nodes appear under image/sprite. The animation variant takes an image batch, detects one shared grid across all frames, and downsamples each frame against it, so the cleaned animation stays temporally stable instead of flickering.

Includes a pixelated preview extension that sets image-rendering: pixelated on ComfyUI preview images.

Idempotent — processing an already-clean image returns it unchanged. Safe to leave in the workflow.

Node parameters

Parameter Default Description
min_grid 4 Minimum grid cell size to detect (1–32)
quantize 8 Color quantization bits (4–8). Lower = tighter palette
remove_background none none, before, or after detection
crop false Crop to non-transparent content after processing

Sources

See also