Sprite Animator
Turn any image into an animated pixel art sprite GIF. Uses Gemini image generation to create 16-frame sprite sheets, then assembles them into looping GIFs.
Requirements
GEMINI_API_KEY or GOOGLE_API_KEY env var must be set
- Install:
uv tool install sprite-animator (or uvx sprite-animator for one-off runs)
Quick Usage
# Best quality for photos — two-step converts to pixel art first, then animates
sprite-animator -i photo.png -o dance.gif -a dance --two-step -s 256 -r 2K
# From drawings or pixel art (single step is fine)
sprite-animator -i drawing.png -o idle.gif -a idle -s 256 -r 2K
Animation Types
idle — gentle breathing + blink (default)
wave — arm raise → wave → return
bounce — crouch → jump → land
dance — lean, spin, jump — full party mode
Key Options
| Flag |
Description |
Default |
-i |
Input image path |
required |
-o |
Output GIF path |
required |
-a |
Animation type (idle/wave/bounce/dance) |
idle |
-s |
Output sprite size in px |
128 |
-r |
Generation resolution (1K/2K) |
1K |
-d |
Frame duration in ms |
100 |
--two-step |
Pixelate first, then animate (better for photos) |
off |
--keep-sheet |
Save raw sprite sheet |
off |
--keep-frames |
Save individual frame PNGs |
off |
Tips
- Use
--two-step for photos of real people — Gemini loses likeness otherwise
- Use
-r 2K for noticeably better quality
- Use
-d 180 for more natural playback speed (default 100ms is fast)
- Save good base pixel art sprites and reuse them for different animations
- On Telegram, send GIFs as documents to avoid MP4 conversion
Python API
from pathlib import Path
from PIL import Image
from sprite_animator.cli import ANIMATION_PRESETS, generate_sprite_sheet, create_gif, call_gemini, get_api_key
from sprite_animator.template import create_template, extract_frames
api_key = get_api_key()
preset = ANIMATION_PRESETS["dance"]
# Create template and generate sprite sheet
template = create_template(cols=4, rows=4, labels=preset["labels"])
template.save("template.png")
generate_sprite_sheet(
api_key=api_key,
input_image=Image.open("input.png"),
template_path=Path("template.png"),
output_path=Path("sheet.png"),
prompt=preset["prompt"],
resolution="2K",
)
# Extract frames and build GIF
frames = extract_frames(Image.open("sheet.png"), cols=4, rows=4)
create_gif(frames, Path("output.gif"), frame_duration=180, size=256)
1---2name: sprite-animator3description: Generate animated pixel art sprite GIFs from any image using AI (Gemini). Use when the user wants to create pixel art animations, sprite sheets, animated character GIFs, or convert photos/drawings into retro game-style animated sprites. Supports idle, wave, bounce, and dance animations.4license: MIT5metadata:6 source: https://skillmd.com/skills/olafs-world/sprite-animator7 author: Olafs-World8 version: "0.2.1"9---1011# Sprite Animator1213Turn any image into an animated pixel art sprite GIF. Uses Gemini image generation to create 16-frame sprite sheets, then assembles them into looping GIFs.1415## Requirements1617- `GEMINI_API_KEY` or `GOOGLE_API_KEY` env var must be set18- Install: `uv tool install sprite-animator` (or `uvx sprite-animator` for one-off runs)1920## Quick Usage2122```bash23# Best quality for photos — two-step converts to pixel art first, then animates24sprite-animator -i photo.png -o dance.gif -a dance --two-step -s 256 -r 2K2526# From drawings or pixel art (single step is fine)27sprite-animator -i drawing.png -o idle.gif -a idle -s 256 -r 2K28```2930## Animation Types3132- `idle` — gentle breathing + blink (default)33- `wave` — arm raise → wave → return34- `bounce` — crouch → jump → land35- `dance` — lean, spin, jump — full party mode3637## Key Options3839| Flag | Description | Default |40|------|-------------|---------|41| `-i` | Input image path | required |42| `-o` | Output GIF path | required |43| `-a` | Animation type (idle/wave/bounce/dance) | idle |44| `-s` | Output sprite size in px | 128 |45| `-r` | Generation resolution (1K/2K) | 1K |46| `-d` | Frame duration in ms | 100 |47| `--two-step` | Pixelate first, then animate (better for photos) | off |48| `--keep-sheet` | Save raw sprite sheet | off |49| `--keep-frames` | Save individual frame PNGs | off |5051## Tips5253- Use `--two-step` for photos of real people — Gemini loses likeness otherwise54- Use `-r 2K` for noticeably better quality55- Use `-d 180` for more natural playback speed (default 100ms is fast)56- Save good base pixel art sprites and reuse them for different animations57- On Telegram, send GIFs as documents to avoid MP4 conversion5859## Python API6061```python62from pathlib import Path63from PIL import Image64from sprite_animator.cli import ANIMATION_PRESETS, generate_sprite_sheet, create_gif, call_gemini, get_api_key65from sprite_animator.template import create_template, extract_frames6667api_key = get_api_key()68preset = ANIMATION_PRESETS["dance"]6970# Create template and generate sprite sheet71template = create_template(cols=4, rows=4, labels=preset["labels"])72template.save("template.png")7374generate_sprite_sheet(75 api_key=api_key,76 input_image=Image.open("input.png"),77 template_path=Path("template.png"),78 output_path=Path("sheet.png"),79 prompt=preset["prompt"],80 resolution="2K",81)8283# Extract frames and build GIF84frames = extract_frames(Image.open("sheet.png"), cols=4, rows=4)85create_gif(frames, Path("output.gif"), frame_duration=180, size=256)86```