pixelc is a deterministic, cross-platform sprite-atlas compilation toolchain. It takes PNG sprite frames (or spritesheets), slices, trims, pivots, and packs them into an optimized atlas — then exports metadata ready to drop into your game engine.
It ships as both a CLI for pipeline automation and a desktop GUI for visual, drag-and-drop workflows.
- Features
- How It Works
- Installation
- Quick Start
- CLI Reference
- Configuration File
- Output Format
- Desktop GUI
- Development
- Packaging & Release
- Project Structure
- 🎯 Deterministic output — same input always produces the same atlas, bit-for-bit
- ✂️ Auto-slicing — accepts a whole spritesheet PNG or a folder of individual frames
- 🔲 Transparent trim — strips empty alpha border from each sprite to save atlas space
- 📌 Pivot points — configurable pivot per sprite (
center,bottom-center) - 📦 Smart packing — bin-packs sprites with configurable padding
- 🔢 Power-of-two atlas — optional constraint for GPU compatibility
- 🎬 Animation metadata — infers animation states and FPS from frame filename conventions
- 📤 Unity export preset — outputs
atlas.png+atlas.jsoncompatible with Unity's sprite atlas system - 🗂️ Batch mode — recursively compile entire asset directories in one command
- 🧪 Dry-run mode — preview output dimensions without writing any files
- 🖥️ Desktop GUI — Electron + React app for visual compilation without touching the terminal
Input PNG / Folder of PNGs
│
▼
[1] Slice ← split spritesheet rows/cols, or load individual frames
│
▼
[2] Trim ← remove transparent padding from each sprite
│
▼
[3] Pivot ← compute pivot point (center / bottom-center)
│
▼
[4] Pack ← bin-pack all sprites onto an atlas with padding
│
▼
[5] Export ← write atlas.png + atlas.json (Unity preset)
git clone https://github.com/your-org/spriteforge
cd spriteforge
# Build the CLI (output to ./pixelc_bin to avoid conflict with source dir)
go build -o pixelc_bin ./cmd/pixelc
# Optionally add to PATH
sudo mv pixelc_bin /usr/local/bin/pixelcDownload the latest release for your platform from the Releases page.
| Platform | File |
|---|---|
| Linux (x86_64) | pixelc-linux-amd64.tar.gz |
| macOS | pixelc-macos.tar.gz |
| Windows | pixelc-windows.zip |
pixelc compile hero_walk.png --out ./outpixelc compile ./frames/hero_walk/ --out ./outpixelc compile ./assets/ --out ./out --batchpixelc compile hero_walk.png --out ./out --dry-run| Flag | Default | Description |
|---|---|---|
--out <dir> |
(required) | Output directory for atlas.png and atlas.json |
--preset <name> |
unity |
Export preset. Currently supported: unity |
--connectivity <4|8> |
4 |
Pixel connectivity for sprite boundary detection |
--padding <n> |
0 |
Padding in pixels between sprites on the atlas |
--pivot <mode> |
center |
Pivot point mode: center or bottom-center |
--power2 |
false |
Force atlas dimensions to be powers of two |
--fps <n> |
12 |
Frames per second written into animation metadata |
--batch |
false |
Recursively compile subdirectories as separate atlases |
--dry-run |
false |
Plan and print output without writing any files |
--report |
false |
Write a report.json alongside the atlas outputs |
--ignore <glob> |
— | Glob pattern to exclude from batch mode (repeatable) |
--config <file> |
— | Path to a JSON config file (see below) |
Prints the current version string.
Checks the environment and confirms pixelc is correctly installed.
doctor ok os=linux arch=amd64 temp=/tmp/pixelc-doctor-...
Instead of passing flags every time, you can save your settings in a JSON config file:
{
"connectivity": 4,
"padding": 2,
"pivotMode": "center",
"powerOfTwo": false,
"preset": "unity",
"fps": 12,
"ignore": ["**/temp/**", "**/unused/**"]
}Then reference it with:
pixelc compile ./assets/ --out ./out --batch --config cfg.jsonCommand-line flags take priority over config file values.
pixelc writes two files to the output directory:
A tightly packed PNG sprite atlas containing all input sprites.
A JSON file describing each sprite's position, dimensions, pivot, and any detected animation states:
{
"frames": {
"hero_walk_0": {
"frame": { "x": 0, "y": 0, "w": 48, "h": 64 },
"pivot": { "x": 0.5, "y": 0.5 }
},
"hero_walk_1": {
"frame": { "x": 48, "y": 0, "w": 48, "h": 64 },
"pivot": { "x": 0.5, "y": 0.5 }
}
},
"animations": {
"hero_walk": {
"fps": 12,
"frames": ["hero_walk_0", "hero_walk_1"]
}
},
"meta": {
"app": "pixelc",
"version": "1.0.0",
"image": "atlas.png",
"size": { "w": 256, "h": 256 }
}
}Animation detection: pixelc infers animations from frame filenames. Frames named
hero_walk_0.png,hero_walk_1.pngare grouped into an animation calledhero_walkautomatically.
For a visual workflow, pixelc ships with a desktop application built on Electron + React.
- Node.js 20+
- npm
cd pixelc/apps/gui
npm install
npm run devThe app window will open on your desktop. It lets you:
- Browse for your input file or folder via a native file picker
- Configure all compile options visually (preset, padding, pivot, FPS, etc.)
- Watch real-time compile logs as pixelc runs
- Open the output folder when done
npm run package # builds for current platform
npm run package:dir # unpacked build (no installer)Packaged apps are written to dist/. The pixelc CLI binary is automatically bundled inside the app.
go test ./...go vet ./...
./scripts/verify.shgo run ./scripts/no_binary.goPIXELC_BIN=./pixelc_bin go test -tags smoketool ./scripts -run TestSmokeHarness -vgo test ./... -bench=. -benchmem -run=^$ > bench.txt
go run -tags benchgate ./scripts/bench_gate.go bench.txtCross-platform release packages are produced by platform-specific scripts in scripts/package/.
# Linux
./scripts/package/package_linux.sh 1.0.0 <commit> <build-date>
# macOS
./scripts/package/package_macos.sh 1.0.0 <commit> <build-date>
# Windows (PowerShell)
pwsh ./scripts/package/package_windows.ps1 -Version 1.0.0 -Commit <commit> -BuildDate <build-date>NC-OSL v1.0 — Non-Commercial, Share-Alike © Pomaieco