Fix AI pixel art

Image models paint pictures that look like pixel art without being it: the blocks drift in size, the edges are blurred, and one red is forty reds. Polymation snaps them onto a true grid, one colour per cell at 1×, with a real palette. Games and Rive need the real thing.

You bring
"Pixel art" from ChatGPT, Gemini, Midjourney, Stable Diffusion, Flux or any other model: one picture, or a folder of them.
You get
Clean 1× PNGs and an enlarged preview to compare.
Needs
Nothing beyond the install.

Ask your assistant

  • Snap knight.png onto a real pixel grid with at most 16 colours.
  • These 8 walk frames came out of ChatGPT slightly different sizes. Put them all on one grid with one palette.
  • I drew a hat on my character with Gemini. Line it up with the original exactly and give me the hat as its own layer.
  • Map this sprite onto my game's palette: #1a1c2c, #5d275d, #b13e53, …

How it works

  1. snap_pixel_art measures the block size, rebuilds the grid, merges near-identical colours and removes a flat background. It writes the picture at 1× and an enlarged preview.
  2. Your assistant looks at the preview beside the original, and adjusts only what looks wrong:
    • Too many colours: a colour limit, or your own palette.
    • Stray single pixels: a clean-up of small specks.
    • A broken outline: one even 1-pixel outline in the darkest colour.
    • The figure should be smaller: a height in pixels, for a coarser grid than the model drew.
    • A green fringe at the edge: spill removal.
    • Background left behind: a looser tolerance.

Many pictures on one grid

  • Frames or a set of items: give a folder. Every picture is snapped on one shared grid and colour set, so they stay consistent.
  • An item, pose or face drawn over a character: snap the character first, then each variant against it. Each variant lands exactly on the character: lined up on its floor, matched by colour, and every unchanged pixel set back to the character's own. extract_layer then lifts the change out as its own layer.

Better pictures to start with

sprite_art_brief writes prompts for your image model that ask for a flat background colour the character doesn't use, a whole number of pixels per block, and one figure per picture.

After snapping

  • Into Rive: pixel art is recognised and drawn crisp by itself, with no blur between pixels, at whole-number scales.
  • Animate the character: Animate a pixel character.
  • See what its colours became: pixel_materials splits the colours into materials (skin, each cloth, metal) and their shading levels.
  • Move parts of it simply: split_image moves part of a picture on its own (clothes ride along), and snap_motion_to_pixels turns any motion into whole-pixel steps.

Good to know

  • Crisp drawing of pixel art needs Rive's GPU renderer, which apps use. Rive's 2D-canvas web runtime smooths pictures, so scale pixel art up by whole pixels before using it there.

Related