Sandbox
@gary149/h3-game-sprites

Agent skill for video-to-sprite sheets in Claude Code

This skill turns short AI-generated clips into 2D sprite sheets for game characters. It covers the pose still recipe, idle pinning, frame extraction, chroma key cleanup, keyframe selection, and atlas packing so the character stays aligned and readable in-engine.

117 stars7 forksPythonUpdated 1mo ago
Who it's for

Builders who use Claude Code or other skills-compatible agents to make game sprites from generated video.

What it delivers

You can turn a short generated clip into a keyed sprite strip and atlas instead of hand-cutting animation frames.

What it does

Character still recipe

Defines the side view, planted feet, and flat magenta backdrop needed for clean chroma keying.

Idle pin

Sets the first and last frame of each move to the same idle still so animations return to neutral cleanly.

Move brief guidance

Gives prompts and guards for clips like attacks and treadmill-style walks so the engine controls movement.

Sprite cutting and keying

Extracts frames from video, keys the background, despills color, and selects frames by motion arc length.

Loop detection

Finds seamless walk cycles instead of including start-up and settle frames that make loops visibly reset.

Atlas building math

Builds a shared-scale atlas with ankle-centroid anchoring and render offsets that keep sprites on the floor.

Verification metrics

Reports key purity, pose return, feet drift, and on-screen pose height so you can check the result visually and numerically.

How to get it

  1. 1Copy the skill folder into wherever your agent looks for skills. For Claude Code
    git clone https://github.com/gary149/h3-game-sprites
    cp -R h3-game-sprites/skills/h3-game-sprites ~/.claude/skills/

README

h3-game-sprites

An Agent Skill for turning AI-generated video into 2D game sprite sheets.

Mortal Kombat (1992) filmed actors and digitized the footage into sprites. This does the same thing with a video model as the actor: one short clip per move, cut down to its pose extremes, chroma-keyed to transparency, and packed into an atlas you can drop into an engine. A character with eight moves costs about $5 and lands in an afternoon.

Animated punch, cut from a single generated clip

Twelve keyed sprite frames selected from 124 video frames

What it covers

  • The character-still recipe: side view, planted feet, flat magenta backdrop, and the "no grain, no dust, no vignette" clause that keeps the chroma key clean.
  • The idle pin: setting a move clip's first and last frame to the same idle still, so the character cannot drift off-model, every animation returns to neutral, and moves chain in a state machine.
  • Clip briefs, including the guards that stop cartoon models ballooning fists on impact and the in-place ("treadmill") walk phrasing that keeps the engine in charge of movement.
  • Frame extraction, keying with a despill that does not tint the character, and keyframe selection by cumulative motion arc-length rather than uniform sampling.
  • Seamless walk-cycle detection, because whole-clip keyframes include the start-up and the settle back to idle, which is what makes a walk visibly reset instead of loop.
  • The atlas and rendering math: one global scale (never per-frame normalization), anchoring from the ankle centroid, and the drawImage offset that decides whether your character stands on the floor or sinks through it.

Install

Copy the skill folder into wherever your agent looks for skills. For Claude Code:

git clone https://github.com/gary149/h3-game-sprites
cp -R h3-game-sprites/skills/h3-game-sprites ~/.claude/skills/

The format is portable across skills-compatible agents; adjust the destination directory to match your client.

Requirements

The local half of the pipeline (keying, keyframe selection, atlas building) needs only ffmpeg and Python 3 with Pillow and numpy. sprite_cut.py and build_atlas.py take an ordinary video file, so they work regardless of what produced it.

Generation needs a video model and an image model, and neither is pinned to one vendor. H3 / Hailuo 3 is served by aggregators such as OpenRouter and fal, and by MiniMax directly. The character still can come from whichever image model you prefer, or from an illustrator, as long as it follows the pose and flat-backdrop recipe in the skill. Budget roughly $0.60-0.70 per five-second clip and a few cents per still, varying by provider.

The bundled gen_still.py is a convenience, not a constraint: it defaults to Nano Banana (google/gemini-3.1-flash-image) through OpenRouter and reads OPENROUTER_API_KEY. Point the endpoint and model constants at the top of the file somewhere else, or skip the script and bring your own still.

Scripts

ScriptDoes
scripts/gen_still.pyGenerate character and pose stills, with reference images and a parallel batch mode for style probes
scripts/sprite_cut.pyExtract, chroma-key, pick keyframes, emit a strip, a GIF and a metrics report; --loop finds a seamless cycle
scripts/build_atlas.pyPack frames into an atlas at one global scale with shared anchors

Each runs standalone, so the pipeline is usable without an agent driving it:

python3 scripts/sprite_cut.py clips/punch.mp4 sprites/punch --frames 12
python3 scripts/sprite_cut.py clips/walk.mp4  sprites/walk  --frames 8 --loop
python3 scripts/build_atlas.py sprites/ atlas.json --moves idle,walk,punch --ref idle

Verifying, not vibing

Every stage emits numbers you can check: key purity per frame, how closely a move returns to its starting pose, feet drift, and on-screen pose heights. The guidance leans on this hard, because the failure modes here are visual and quiet. A sprite that renders at the wrong scale, or one that hangs below the floor, will pass any assertion written against atlas metadata alone. Measure the rendered canvas.

License

MIT

Files in the repo

Repository payload5 top-level entries
  • examples
  • skills
  • .gitignore
  • LICENSE
  • README.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More skills

obra/
superpowers

An agentic skills framework & software development methodology that works.

285k
1 add

Turn any codebase, with its docs, SQL schemas, configs, and PDFs, into a queryable knowledge graph. A /graphify skill for Claude Code, Cursor, Codex, and Gemini CLI: local deterministic AST parsing, every edge explained, no vector store.

117k
1 add
Vincentwei1021/
anything2explainer

Topic in, narrated explainer video out. A Claude Code / Codex skill that turns any topic into a black-canvas motion-graphics explainer video with TTS voiceover, subtitles and a chapter progress bar. Chinese or English; every frame drawn in code with Remotion.

666

Open-source AI job search: scan job portals, evaluate listings into a structured A-H report with a global 1-5 score, tailor your CV, track applications — runs locally in your AI coding CLI (Claude Code, Codex, OpenCode, Antigravity…)

71k