Pack animation frames into engine-ready sprite sheets with Aseprite CLI, TexturePacker or Python, including JSON metadata, padding and extrusion against bleeding, and Godot, Unity and Phaser import settings. Triggers: "make a sprite sheet", "pack these frames", "export Aseprite animation", "texture atlas for Phaser".
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Studio Sprite Sheet Export?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/tinh2-studio-sprite-sheet-export)
---
name: studio-sprite-sheet-export
description: Pack animation frames into engine-ready sprite sheets with Aseprite CLI, TexturePacker or Python, including JSON metadata, padding and extrusion against bleeding, and Godot, Unity and Phaser import settings. Triggers: "make a sprite sheet", "pack these frames", "export Aseprite animation", "texture atlas for Phaser".
version: "1.0.0"
category: gamedev
platforms: [CLAUDE_CODE, CURSOR, CODEX_CLI]
---
# Sprite sheet export
Goal: a single atlas image plus metadata that the engine imports with no bleeding, no jitter and correct timings.
## Inputs to agree on
- Source: Aseprite files with tags, a folder of PNG frames, or rendered frames from Blender or Spine.
- Target engine and version: Godot 4, Unity (2D Sprite), Phaser 3, PixiJS, custom.
- Art style: pixel art (nearest filtering, integer scale) or smooth (linear filtering, mipmaps).
- Max atlas size: 2048x2048 is safe on all mobile GPUs; 4096 on desktop.
- Animation list with frame durations, loop modes and pivot points.
## Toolchain
- Aseprite CLI (`aseprite -b`): best for pixel art with tags and per-frame durations.
- TexturePacker CLI (paid, free basic mode): many engine exporters, trimming, polygon packing.
- Free Texture Packer, or a Python script with Pillow for full control.
- Engine-side: Godot SpriteFrames/AnimatedSprite2D, Unity Sprite Editor, Phaser `load.atlas` or `load.aseprite`.
## Workflow
### 1. Normalize frames
- Same canvas size per animation, consistent pivot (usually bottom center for characters).
- Name frames `name_tag_0000.png` so sort order is stable.
- Pixel art: no anti-aliased edges against transparency, no semi-transparent stray pixels (check with an alpha threshold).
### 2a. Aseprite CLI
```bash
aseprite -b hero.aseprite \
--sheet hero.png --data hero.json \
--format json-array \
--sheet-type packed \
--trim --shape-padding 2 --border-padding 2 --inner-padding 0 \
--extrude \
--list-tags --list-slices \
--filename-format "{title}_{tag}_{tagframe00}"
```
- `--sheet-type packed` uses a bin packer; `rows`, `columns` or `horizontal` give grids for engines that want a uniform grid (then omit `--trim`).
- `--extrude` duplicates edge pixels by 1 px to stop bleeding under filtering.
- `--list-tags` writes `meta.frameTags` with from, to and direction; frame `duration` (ms) is per frame.
- Export a single tag: add `--tag run`. Scale pixel art for previews with `--scale 2`, never for engine use.
### 2b. TexturePacker CLI
```bash
TexturePacker --format phaser --data hero.json --sheet hero.png \
--max-size 2048 --size-constraints POT \
--trim-mode Trim --extrude 1 --shape-padding 2 --border-padding 2 \
--algorithm MaxRects --pack-mode Best \
--disable-rotation \
frames/
```
Swap `--format` for `godot4-spritesheet`, `unity-texture2d`, `pixijs4`, `json-array` as needed. Disable rotation unless the engine importer supports rotated frames.
### 2c. Python grid packer (no dependencies beyond Pillow)
```python
from PIL import Image
import json, glob, math, os
frames = sorted(glob.glob("frames/*.png"))
imgs = [Image.open(f).convert("RGBA") for f in frames]
fw, fh = imgs[0].size
pad, ext = 2, 1 # spacing between cells, edge extrusion
cols = math.ceil(math.sqrt(len(imgs)))
rows = math.ceil(len(imgs) / cols)
cell_w, cell_h = fw + 2 * ext + pad, fh + 2 * ext + pad
sheet = Image.new("RGBA", (cols * cell_w + pad, rows * cell_h + pad), (0, 0, 0, 0))
meta = {"frames": [], "meta": {"image": "sheet.png", "size": {"w": sheet.width, "h": sheet.height}}}
for i, im in enumerate(imgs):
cx, cy = pad + (i % cols) * cell_w, pad + (i // cols) * cell_h
# extrude: paste stretched edges first, then the frame
big = im.resize((fw + 2 * ext, fh + 2 * ext), Image.NEAREST)
sheet.paste(big, (cx, cy))
sheet.paste(im, (cx + ext, cy + ext))
meta["frames"].append({"filename": os.path.basename(frames[i]),
"frame": {"x": cx + ext, "y": cy + ext, "w": fw, "h": fh},
"duration": 100})
sheet.save("sheet.png", optimize=True)
json.dump(meta, open("sheet.json", "w"), indent=2)
```
The resize trick only approximates extrusion; for exact edge copies, paste 1 px strips from each border. It is fine for most pixel art.
### 3. Engine import
Godot 4:
- Import the PNG with Filter = Nearest for pixel art (Project Settings > Rendering > Textures > Default Texture Filter, or per node `texture_filter`), Mipmaps off, Compress Mode Lossless.
- Uniform grid: AnimatedSprite2D > SpriteFrames > "Add frames from sprite sheet", set H/V frames and separation/offset matching your padding.
- Packed atlas: use an importer plugin (for example "Aseprite Wizard" or the TexturePacker Godot importer) or build AtlasTextures from the JSON in a tool script.
Unity:
- Texture Type Sprite (2D and UI), Sprite Mode Multiple, Pixels Per Unit matching your art grid, Filter Mode Point for pixel art, Compression None (or high-quality), Generate Mip Maps off, Wrap Mode Clamp.
- Slice in the Sprite Editor (Grid By Cell Size with padding), or import the Aseprite file directly with the Aseprite Importer package.
- Set the pivot per sprite (Bottom for characters).
Phaser 3:
```js
this.load.aseprite("hero", "hero.png", "hero.json"); // reads frameTags
// in create():
this.anims.createFromAseprite("hero");
this.add.sprite(100, 100, "hero").play({ key: "run", repeat: -1 });
// or for TexturePacker/json-array: this.load.atlas("hero", "hero.png", "hero.json");
```
Game config for pixel art: `pixelArt: true` (sets nearest filtering and rounds pixels).
## Variants
- Normal maps for 2D lighting: pack a second sheet with identical layout (same frame order, no trimming differences).
- Multiple resolutions: export @1x and @2x with the same JSON structure; scale padding too.
- Fonts and UI: same packer, separate atlas so UI does not evict gameplay textures.
- Huge animations: split per character or per animation to stay under 2048.
## Quality checks
- Atlas dimensions within the max; power of two if the target compresses (ETC/PVRTC).
- Packing efficiency (used area over total) above about 70 percent for packed sheets.
- Zoom the game at 3x and move the camera at sub-pixel speeds: no colored lines at frame edges.
- Every animation plays at the intended duration (compare the JSON durations to the brief).
- Frames do not jitter between each other: pivots consistent after trimming (packers store `spriteSourceSize` so offsets are restored).
- PNG optimized (`oxipng -o 4 sheet.png`) without changing pixels.
## Pitfalls and fixes
- Bleeding lines: add extrusion and padding, disable mipmaps for 2D, use nearest filtering, keep camera at integer positions for pixel art.
- Jitter after trimming: engine ignores trim offsets; either disable trim or use an importer that reads `spriteSourceSize`.
- Premultiplied alpha mismatch causes dark halos: match the packer's premultiply setting to the engine.
- Rotated frames appear sideways: disable rotation in the packer.
- Blurry pixel art in Unity: Filter Mode Point and Compression None; check Pixels Per Unit.
## Deliverables
- [ ] `*.png` atlas (or atlases) within size limits
- [ ] `*.json` metadata with tags and durations
- [ ] Engine import notes or preset (Unity preset, Godot `.import` settings)
- [ ] The exact pack command or script
- [ ] A small test scene or GIF showing each animation playing