Fixing Uneven AI Sprite Sheets: Grid, Duplicates, Alignment

An AI model asked for a sprite sheet will usually paint something that looks like a grid. It is not a grid. Cells drift by a few pixels, the gap between columns changes, one pose is missing, two frames are identical, and a sword floats slightly outside its cell.

Slicing that image with a uniform grid produces cut-off limbs and a character that jumps. This guide is about repairing the sheet instead of pretending it is regular.

If you want the tool while you read, it is here: AI Sprite Sheet Fixer.

Why AI sheets are uneven

The model is not laying out a grid. It is generating an image that resembles the idea of a sprite sheet: repeated poses, roughly in rows, roughly the same size. That produces four predictable failures:

Failure What it looks like Why it happens
Drifting cells Rows are not evenly spaced; a pose crosses into the next cell The model paints by composition, not coordinates
Missing pose A walk cycle has 6 frames instead of 8 The model drops a step it cannot fit
Duplicate pose Two frames are pixel-identical The model repeats a pose to fill space
Detached parts A sword, shadow, or effect sits away from the body No concept of a single sprite boundary

A grid slice cannot fix any of these. You need to find the actual content first.

Diagnose in 60 seconds

Before touching a tool, look at the sheet at 100% and answer:

  1. Is there a consistent cell size? Draw an imaginary grid. Do the feet line up on a baseline?
  2. Does any sprite cross a cell border? If yes, the grid is wrong at that column or row.
  3. Are any frames identical? Flip between adjacent poses.
  4. Is the background one flat color? If it is painted, fix the background first.

If the answer to (1) is “mostly,” grid mode is fine. If it is “no,” use auto-detect.

Three repair strategies

1. Grid slice — when the sheet is almost regular

Use this when the model respected the layout and only the content inside each cell is imperfect.

The risk: one wrong column count cuts every sprite in that column.

2. Auto-detect — when the layout is fictional

This is the reliable path for AI sheets. The tool:

  1. Samples the corner color as the background.
  2. Builds a foreground mask (alpha or color distance).
  3. Finds connected regions.
  4. Merges nearby regions into one frame.
  5. Filters regions below a minimum area.
  6. Sorts them in reading order.

Use auto-detect when the sheet has a flat or transparent background and the sprites are separated by at least a few pixels.

3. Rebuild uniform cells — always

Detection gives you regions; it does not give you an animation. Every region must be placed into a cell of the same size, or the character will shift when the engine plays the frames.

The rebuild step:

That is the difference between “I cut the sprites” and “I have an animation.”

Step by step in the fixer

  1. Load the sheet. A transparent PNG is easiest; a flat JPG works if the background is one color.
  2. Pick Auto-detect unless you know the exact grid.
  3. Set the background tolerance. Raise it until the background disappears. If the character starts to erode, you went too far.
  4. Set the minimum area. Raise it to ignore specks and stray pixels. A value around 0.05% of the image is a reasonable start.
  5. Set the merge gap. Increase it when a sword, shadow, or detached hand becomes a separate frame.
  6. Check the boxes. The preview numbers each region. If two characters are merged into one box, the gap is too large or the sprites touch in the source.
  7. Turn on duplicate removal only if the sheet repeats poses. Leave it off for intentional holds.
  8. Build and check the preview. Every cell should be the same size and the character should sit on the same baseline.
  9. Download PNG + JSON, then use the SpriteFrames generator for Godot.

The failure cases, and what to change

Symptom Cause Fix
Sword is a separate frame Detached part Raise merge gap by 2–6 px
Tiny specks become frames Noise or JPEG artifacts Raise minimum area
Two characters become one frame They touch, or merge gap is huge Lower the gap; use grid mode
A frame is missing The model omitted a pose Duplicate a nearby pose or regenerate that frame
Frames are in the wrong order Model laid them out right-to-left or in columns Rename/reorder in the sheet maker before building
Character jumps between cells Different region sizes, no uniform bounds Rebuild with uniform cells; check the pivot
Halo around the sprite Background color remains on the edge Use the background remover with contract + threshold

Alignment is not the same as trimming

Trimming finds the visible pixels. Alignment decides where those pixels sit relative to the character’s origin.

For a side-view character, the usual setup is:

In Godot, AnimatedSprite2D does not store a per-frame pivot. It uses the node’s centered flag and offset. That is why uniform cells matter: one offset has to work for every frame. The full import path is in Godot 4: SpriteFrames from a sprite sheet.

A pre-flight checklist

Before you export, confirm:

If a box fails, fix it before importing. Engines are forgiving about a lot of things; they are not forgiving about a sprite that jumps.

FAQ

Can I fix a sheet with a painted background? Not with a color key. Remove the background with a matte first, then fix the grid. Auto-detect assumes a flat or transparent background.

Should I use grid or auto-detect for a 4×4 AI sheet? Try auto-detect first. If the model respected the layout, grid mode is faster; if the boxes look wrong, auto-detect is more reliable.

Why does duplicate removal delete a frame I wanted? It compares a small grayscale signature; two poses that look similar at low resolution can match. Turn it off for holds and reactions.

Can I keep the original order? Auto-detect sorts in reading order. If the model painted columns or right-to-left, rename the frames in the sheet maker before rebuilding.

Does this work for a single sprite? Yes, but the tool is built for a sequence. For one sprite, the background remover is usually enough.


Next: Why AI animations flicker — the frame-to-frame problems a grid fix cannot solve.