The UNIX-way sprite sheet generator.
A free, scriptable, high-quality sprite packer for any pipeline.
sprat-cli is a modular toolkit for generating sprite sheets (texture atlases) from the command line. Unlike monolithic GUI tools, it splits the packing process into discrete, pipeable commands. This makes it perfect for:
- CI/CD Pipelines: Automate asset generation in your build process.
- Shell Scripting: Integrate naturally with
|,>, and standard text tools. - Game Development: Optimized packing algorithms for GPU memory, plus markers, animations, cutout puppets (rigs, poses and pose sequences) and tile types for engines.
- Web & Apps: Export to CSS, JSON, XML, or custom formats.
sprat-cli is a free, scriptable, high-quality sprite packer for any pipeline. It is
designed for anyone who wants repeatable atlas builds without a GUI, from a solo
developer to a studio pipeline team.
You do not need to be a programmer for the basic workflow: install the tools, put your images in a folder, and run a few commands.
If you want a drag-and-drop editor with a visual packing preview, sprat-cli is not that
by itself; it is designed to be the packing engine behind such a tool as well as a CLI
you can use directly.
A sprite sheet (also called a texture atlas) is one image that contains many smaller images. Games load one texture instead of dozens, which is faster.
The tools split the job into small steps:
spratlayoutlooks at your images and decides where each one goes.spratpackdraws the final sheet image.spratconvertwrites the metadata that tells your engine where each sprite is.
Useful terms:
| Term | Plain meaning |
|---|---|
| Atlas | The final image containing all sprites. |
| Layout | A text file listing each sprite's position in the atlas. |
| Metadata | A file (JSON, plist, .tres, ...) that tells your engine where each sprite is. |
| Trim | Remove transparent borders around a sprite to save space. |
| Padding | Empty pixels between sprites so they do not bleed into each other. |
| Extrude | Repeat a sprite's edge pixels into the padding to avoid seams. |
| Multipack | Split sprites across several atlas images when one is too small. |
| Tool | What it does |
|---|---|
spratlayout |
Scans images and computes their positions in the atlas (a plain-text layout) |
spratpack |
Reads a layout and writes the atlas image |
spratconvert |
Turns a layout into metadata: Godot, Unity, Phaser, libGDX, Aseprite, plist, JSON, XML, CSV, CSS or your own Jsonnet transform |
spratframes |
Detects the sprites in an existing sheet |
spratunpack |
Extracts sprites from an atlas |
Option A — download a release. Check the Releases page for a prebuilt archive for Linux, macOS or Windows. Unpack it and run the tools from that folder. The release archives include the built-in transforms and the default profile config.
Option B — build from source. You need CMake 3.15 or newer, a C++20 compiler, and git. Then run:
sh build.shThe binaries are generated in the build/ directory. On Windows, use
build\spratlayout.exe, build\spratpack.exe, and so on.
Use PNG, JPG, BMP, TGA, GIF, PSD, PNM, HDR or WebP files. Subfolders are included.
Images are read in natural filename order, so walk2.png comes before walk10.png.
From the project folder, with your images in ./frames:
./build/spratlayout ./frames --trim-transparent --padding 2 > layout.txt
./build/spratpack < layout.txt > spritesheet.png
./build/spratconvert --transform json < layout.txt > layout.jsonYou now have:
spritesheet.png— the atlas image.layout.txt— the plain-text layout (useful for debugging and for re-packing).layout.json— generic metadata.
Replace json with the format your engine expects:
# Godot
./build/spratconvert --transform godot < layout.txt > sprites.json
# Unity (writes a .json, a .meta and one .anim per animation)
./build/spratconvert --transform unity --output-dir ./out -a atlas.png < layout.txt
# Phaser
./build/spratconvert --transform phaser-hash < layout.txt > sprites.jsonSee the spratconvert guide for all formats.
./build/spratframes sheet.png | ./build/spratunpack --output ./recovered_framessudo cmake --install buildEvery tool has --help, and man ./man/sprat-cli.1 describes them all.
command not found— run the tools with their path (./build/spratlayout) or install them. On Windows, usebuild\spratlayout.exe.no valid images found— check the folder path and the file extensions. Hidden files and.spratlayoutignoreentries are skipped.sprites ... exceed the atlas limit— raise--max-width/--max-height, or add--multipackto split across several atlases.Failed to load image— the path in the layout is wrong. Run the tools from the folder that contains your images, or use a list file with explicit paths.- The engine shows the wrong frames — pass
-aand--image-pathso the metadata points at the atlas the way your engine resolves paths. See Image paths inside the metadata. - Paths with spaces — quote them:
"./my frames".
More help: Troubleshooting guide.
Each tool does one thing well and communicates via text:
./frames ──► spratlayout ──► layout.txt ──┬──► spratpack ────► spritesheet.png
└──► spratconvert ─► layout.json
sheet.png ──► spratframes ──► frames.txt ──► spratunpack ──► ./recovered_frames
spratlayout computes positions without writing pixels; with the default options it reads
only image headers, and trimming or deduplication loads pixels when needed. Its layouts are
also cached.
The tools are designed to be called from another program:
- Results go to stdout; warnings and errors go to stderr.
- Exit code 0 means success, 1 means a handled error.
- Layouts and metadata are plain text, so they are easy to inspect and log.
--list-transforms-jsonlists the available metadata formats as JSON.--transforms-dirprints the directory where transforms are loaded from.--profiles-configand--default-profiles-configcontrol profile discovery.--stdin-listreads image paths from stdin;-reads a tar archive from stdin.--output-dirwrites multi-file transforms (Unity, plist, Aseprite, ...) to a folder.
See Integrating sprat-cli for the pipeline contract and integration tips.
Start with the guides for practical examples and common workflows:
- Guides — How to use each tool
- spratlayout: packing modes, profiles, workflows
- spratpack: basic options, debugging, variants
- spratconvert: engine formats, auto-detection
- Extracting sprites: spratframes and spratunpack
- Markers & Animations: pivots, hitboxes, sequences
- Troubleshooting: common errors and fixes
- Integrating sprat-cli: call the tools from a GUI or script
Need all the options? See the Reference:
- spratlayout reference: all options, algorithms, caching
- spratpack reference: compression, GPU formats, scaling
- spratconvert reference: formats, custom transforms, schema
Technical details in Advanced:
- Layout format: nine-slice, dithering, format spec
- Raw format: C/C++ loading
- Data files: complete marker/animation/puppet DSL
- References: free sprites and optimization reading
- Every tool has
--help:./build/spratlayout --help,./build/spratpack --help, etc. - Full manual:
man ./man/sprat-cli.1(orman sprat-cliafter installing) - Detailed docs: see the links above
This is a community project. The repository owner started it and reviews requests, but it is meant to be built together. Bug fixes, tests, documentation and small improvements are usually accepted. New features should be discussed in an issue first. Forks are welcome.
Ways to help: report bugs, test new builds, improve the docs, review pull requests, add engine transforms or presets, and package the tools for your platform. See CONTRIBUTING.md.
AI is used in this project. Documentation is reviewed and updated with AI agents, and pull requests may be reviewed by agents. A human maintainer makes the final decision.
MIT. See LICENSE.
