fastpack is the headless command-line interface. Running it without arguments opens the GUI. Use subcommands for headless operation.
Available subcommands
- pack
- watch
- init
- split
- help
Pack sprites into a texture atlas.
fastpack pack
Pack one or more directories (or individual files) of sprites into a single texture atlas.Arguments
INPUT — One or more paths. Directories are searched recursively for image files (png, jpg, jpeg, bmp, tga, webp, tiff, gif). Files are added directly.
Common options
Output options
Output options
-o, --output <dir> (default: output)Output directory for the texture and data files. Created if it does not exist.--name <basename> (default: atlas)Base filename for output files without extension. Produces <name>.png and <name>.json.--project <file>Load settings from a .fpsheet project file. CLI flags override project file values.Layout options
Layout options
--max-width <n> (default: 4096)Maximum atlas width in pixels.--max-height <n> (default: 4096)Maximum atlas height in pixels.--pack-mode <fast|good|best> (default: good)Compression effort:fast— Single-pass basic strip packer; fastest, largest atlasgood— MaxRects single-pass; good density, moderate speedbest— MaxRects width search; densest atlas, slowest
--size-constraint <any|pot|multiple-of-4|word-aligned> (default: any)Constraint applied to atlas dimensions.--force-squareForce the atlas to be square (width == height).--allow-rotation (default: true)Allow 90° sprite rotation to improve packing density.--border-padding <n> (default: 2)Transparent pixels added around the atlas edge.--shape-padding <n> (default: 2)Transparent gap between adjacent sprites.Sprite processing options
Sprite processing options
--trim-mode <none|trim|crop|crop-keep-pos|polygon> (default: trim)How to strip transparent borders from sprites:none— Pack the full image including transparent borderstrim— Strip transparent borders; store offset for engine reconstructioncrop— Crop tightly to the opaque regioncrop-keep-pos— Like crop but offsets may be negative to keep original registrationpolygon— Build convex hull polygon; pack its bounding box
--trim-margin <n> (default: 0)Pixels of transparent margin to keep around trimmed edges.--trim-threshold <n> (default: 1)Alpha threshold: pixels at or below this value are considered transparent (0–255).--extrude <n> (default: 0)Pixels of border extrusion added to each sprite edge.--detect-aliases (default: true)Deduplicate pixel-identical sprites as aliases.Scale options
Scale options
--scale <factor> (default: 1.0)Scale factor applied to output (e.g. 0.5 produces a half-resolution atlas).--suffix <text> (default: "")Suffix appended to output filenames (e.g. @2x produces [email protected]).--scale-mode <smooth|fast> (default: smooth)Resampling filter:smooth— Lanczos3 resampling; high qualityfast— Nearest-neighbour; crisp pixel art, no blurring
Format options
Format options
--data-format <json-hash|json-array|phaser3|pixijs> (default: json-hash)Output data format:json-hash— Generic JSON object keyed by sprite namejson-array— JSON array of frame objectsphaser3— Phaser 3 multi-atlas formatpixijs— PixiJS sprite sheet format
--texture-format <png|jpeg|webp|dxt1|dxt5> (default: png)Output texture format:png— Lossless PNGjpeg— Lossy JPEG; no alpha channelwebp— WebP (lossless or lossy depending on pack mode)dxt1— DXT1 / BC1 hardware compression; no per-pixel alphadxt5— DXT5 / BC3 hardware compression; full alpha channel
--pixel-format <rgba8888|rgb888|rgb565|rgba4444|rgba5551|alpha8> (default: rgba8888)Pixel bit depth. Floyd-Steinberg dithering is applied when not rgba8888.--premultiply-alphaPremultiply RGB channels by alpha before compression.Advanced options
Advanced options
--multipackEmit additional sheets when sprites overflow the first atlas.--pivot-x <x> and --pivot-y <y>Default pivot coordinates (0.0–1.0). Both are required together.Examples
- Basic usage
- Multiple inputs
- With project file
- High-quality output
build/atlas/ui.png and build/atlas/ui.json.Sprite IDs
Each frame’s ID is the file path relative to the input directory, without extension, with forward slashes as the separator. For a file atsprites/player/idle.png loaded from root sprites/, the ID is player/idle.
When individual files are passed as inputs, the ID is the filename without extension (no directory component).
Output files
<name>.json — Atlas metadata in JSON Hash format. Contains frames (one entry per sprite) and a meta block with atlas dimensions, image filename, pixel format, and scale.
<name>.png — Lossless PNG texture. Pixel format is RGBA8888.
Exit codes
Exit code is0 on success. Exit code is non-zero when:
- No images are found
- All images fail to load
- The packer fails
Technical notes
Phase 1 uses the MaxRects algorithm withBestShortSideFit heuristic, allow_rotation = true, and shape_padding = 2. Sprites are trimmed with TrimMode::Trim and alpha threshold 1. These settings are not yet configurable via flags; full flag coverage is planned for Phase 2.
TexturePacker compatibility
fastpack pack accepts a subset of the flags TexturePacker CLI exposes. Full compatibility mapping (including --format, --data, --sheet) is planned for Phase 6.