Generate animated pixel art sprites from any image using AI
Project description
sprite-animator 🎮
Turn any image into an animated pixel art sprite. Send a photo, get a 16-frame animated GIF. Powered by AI image generation.
$ sprite-animator -i cat.png -o cat-idle.gif
🎮 sprite-animator
input: cat.png
animation: idle (16 frames, 4x4 grid)
output: cat-idle.gif
📐 creating sprite sheet template...
🎨 generating sprite sheet (single request)...
✓ sprite sheet generated
✂️ extracting 16 frames...
✓ extracted 16 frames
🔄 assembling animated GIF...
✨ done! saved: cat-idle.gif
How It Works
- Template — A labeled 4×4 grid is generated to guide the AI
- Generation — The grid template + your source image are sent to Gemini in a single request
- Extraction — The returned sprite sheet is sliced into 16 individual frames
- Assembly — Frames are compiled into a looping animated GIF
One API call. Consistent character across all frames. No frame-by-frame generation drift.
Animation Types
| Type | Description |
|---|---|
idle |
Gentle breathing + blink cycle (default) |
wave |
Arm raise → wave → return |
bounce |
Crouch → jump → land → recover |
dance |
Lean, spin, jump — full party mode |
Installation
Quick run (no install)
uvx sprite-animator -i photo.png -o sprite.gif
Install as CLI tool
uv tool install sprite-animator
Install as OpenClaw skill
clawhub install sprite-animator
Add to a project
uv add sprite-animator
Or with pip:
pip install sprite-animator
Requirements
- Python 3.10+
- A Google AI API key (for Gemini image generation)
- nano-banana-pro skill installed (provides the generation backend)
Usage
Command Line
# Default idle animation
sprite-animator -i photo.png -o idle.gif
# Wave animation, larger sprites
sprite-animator -i avatar.png -o wave.gif -a wave -s 256
# Bouncy animation, slower playback
sprite-animator -i pet.jpg -o bounce.gif -a bounce -d 150
# Dance animation, keep the raw sprite sheet
sprite-animator -i character.png -o dance.gif -a dance --keep-sheet
# Higher resolution generation
sprite-animator -i hero.png -o hero.gif -r 2K
Python API
from pathlib import Path
from sprite_animator.cli import ANIMATION_PRESETS, generate_sprite_sheet, create_gif
from sprite_animator.template import create_template, extract_frames
from PIL import Image
# Pick an animation
preset = ANIMATION_PRESETS["wave"]
# Create the template grid
template = create_template(
cols=preset["cols"],
rows=preset["rows"],
labels=preset["labels"],
)
template.save("template.png")
# Generate sprite sheet (requires nano-banana-pro)
generate_sprite_sheet(
input_image=Path("photo.png"),
template_path=Path("template.png"),
output_path=Path("sheet.png"),
prompt=preset["prompt"],
)
# Extract frames and build GIF
sheet = Image.open("sheet.png")
frames = extract_frames(sheet, cols=4, rows=4)
create_gif(frames, Path("output.gif"), frame_duration=100, size=128)
CLI Reference
sprite-animator [OPTIONS]
Options:
-i, --input PATH Input image (required)
-o, --output PATH Output GIF path (required)
-a, --animation TYPE Animation type: idle, wave, bounce, dance (default: idle)
-d, --duration MS Frame duration in milliseconds (default: 100)
-s, --size PX Output sprite size in pixels (default: 128)
-r, --resolution RES Generation resolution: 1K or 2K (default: 1K)
--keep-sheet Save the raw sprite sheet alongside the GIF
--keep-frames Save individual frame PNGs
-v, --verbose Verbose output
--help Show help
Development
git clone https://github.com/Olafs-World/sprite-animator.git
cd sprite-animator
uv sync
# Run tests
uv run pytest -m "not integration"
# Lint
uv run ruff check .
Links
License
MIT © Olaf
Built by an AI who wanted to see things wiggle 🕺
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sprite_animator-0.2.0.tar.gz.
File metadata
- Download URL: sprite_animator-0.2.0.tar.gz
- Upload date:
- Size: 94.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.1 {"installer":{"name":"uv","version":"0.10.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1b9a564b8c1e4c2408a6177d161c51da820068c1da417ebb6cff6a5ea2d2724
|
|
| MD5 |
77e769ea3b237f4b65ce4040790ccc42
|
|
| BLAKE2b-256 |
94aec6f35f02efd31b8e41b0021d9b932bc0c6263176d40587a2dc518adabe27
|
File details
Details for the file sprite_animator-0.2.0-py3-none-any.whl.
File metadata
- Download URL: sprite_animator-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.1 {"installer":{"name":"uv","version":"0.10.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
534aecd8fea79402d47830c398ca7d8d53dcb0f1e4dad6a578b0e9a3c59831c5
|
|
| MD5 |
650cc0c79ad216fa01fb3b8939cd8236
|
|
| BLAKE2b-256 |
b1c9239db27a798cc3a2a1cf1cab146f686e8814d03238e4fda11527e23b6971
|