Sprite sheet guide

sprite-gen: One Image Becomes a 2D Game Sprite Sheet, Free and Open Source

@terryl.in's sprite-gen is a free open-source (Apache-2.0) Python tool — also a Codex/ Code skill — that turns one character image into a game-ready sprite sheet. The AI draws each action as a row; fixed code strips the background, cuts the frames and assembles the sheet.

What this is

Asking an image AI to draw a sprite sheet directly usually fails — faces change frame to frame, backgrounds don't strip cleanly, poses don't line up. sprite-gen fixes exactly that by letting the AI only draw, while fixed code does the cutout, cutting and assembly. Give it a character image and it has an image AI draw each action as a row while keeping the character's look consistent, strips the solid-colour background to real transparency, cuts every pose into clean transparent frames, and assembles a sprite sheet with a manifest.json the game can read (frame coordinates, playback speed, loop or not). @terryl.in's test: an original chibi knight, walking and sword-swinging, done in under a minute with the image workflow (walk 6 frames, attack 5 frames, 10 fps). Use your subscription to draw (via codex login), no separate API fee; the tool warns in the terminal before anything billable happens.
1

A · Image (atlas rows)

One character image + action list → transparent sprite sheet + manifest.json. Image AI: codex ( login), or openai. Walk 6 frames, attack 5 frames, under 1 minute.

2

B · Video to loop

One character image → each action a transparent looping animation (GIF/WebP/strip). Uses Imagine video. Walk 27 frames, attack 48 frames, about 5 minutes. Smoother than the image workflow, but with its own pitfalls (see below).

3

Small tools (no AI needed)

cutout, slice-sheet, recolor, export, shadow, repeating background.

4

Curation step

Opens a web page to compare, delete and fine-tune each frame and preview the loop before re-assembling (optional).

Install

From the creator's blog. Clone the repo, set up a virtual environment and install: git clone https://github.com/aldegad/sprite-gen cd sprite-gen python3 -m venv .venv && source .venv/bin/activate pip install -e . sprite-gen --help Then `codex login` with your account. As a skill: Codex has an official install command (install-skill-from-github.py --repo aldegad/sprite-gen); Code: copy the folder to ~/.claude/skills/sprite-gen/ and set SPRITE_GEN_ROOT.
1

1. The base image must NOT be transparent

The video flow reads the background colour from the four corners; a transparent base is treated as black when filming and white when cutting out — silver armour gets cut away (floating fists, severed shins, jagged edges). Fix: put the character on a pure green (#00FF00) background first and add --key green.

2

2. The sword grows

draws the sword longer and longer during a swing — up to about twice its original length. sprite-gen can't fix this; check it yourself.

3

3. Attack frames shrink

sprite-gen measures character height including the raised sword, so sword-swing frames come out smaller than walking frames. Align by the standing height yourself when placing them in the game.

4

From the comments: check the feet

Check every frame's feet alignment — if the landing point drifts, the character looks like it's ice-skating in-game. Single actions (attack, jump) are most stable at 4–6 frames, while 9 or 12 frames tend to break (repeated bodies, blank cells).

Where this came from

Creator @terryl.in (Terry L). Source post: https://www.threads.com/@terryl.in/post/DgFRwd2kX6l — full tutorial on the creator's blog: https://terryl.in/zh-tw/blog/sprite-gen — tool repo: https://github.com/aldegad/sprite-gen (Apache-2.0, Python 3.11+). The post's carousel frames and blog images are not yet wired in; the guide reads without them.

更多类似内容

FAC.freeaicommand.com

© 2026 FreeAICommand • 为零压学习而生

支持我们的使命