Overview
Thepack command reads sprite images from input directories or files and packs them into optimized texture atlases with accompanying metadata files.
Basic usage
Examples
Arguments
Input directories or files to search for sprites. When using
--project, this argument is optional and overrides the project’s sources.Options
Project
Load settings from a
.fpsheet project file. When specified, most options come from the project file. CLI flags override project settings.See config-reference for project file format.Output
Output directory for the generated atlas and data file.
Base name for output files (without extension). Produces files like
atlas.png and atlas.json.Layout
Maximum atlas width in pixels. The packer will try to fit sprites within this constraint.
Maximum atlas height in pixels. The packer will try to fit sprites within this constraint.
Compression effort level that controls packing algorithm quality and speed.Values:
fast- Single-pass basic strip packer; fastest, largest atlasgood- MaxRects single-pass; good density, moderate speed (default)best- MaxRects width search; densest atlas, slowest
Constraint applied to atlas dimensions.Values:
any- No constraint; smallest rectangle that fits (default)pot- Width and height must be powers of two (e.g., 512, 1024, 2048)multiple-of-4- Width and height must each be divisible by 4word-aligned- Width and height must each be divisible by 2
Force the atlas to be square (width == height). Useful for some engines that require square textures.
Allow 90° sprite rotation to improve packing density. Rotation data is included in the output metadata.
Padding
Transparent pixels added around the atlas edge. Helps prevent texture bleeding at atlas boundaries.
Transparent gap between adjacent sprites. Helps prevent texture bleeding between sprites.
Trimming
How to strip transparent borders from sprites.Values:
none- Pack the full image including transparent borderstrim- Strip transparent borders; store offset for engine reconstruction (default)crop- 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
Pixels of transparent margin to keep around trimmed edges. Useful for effects that need some transparency.
Alpha threshold: pixels at or below this value (0-255) are considered transparent during trimming.
Processing
Pixels of border extrusion added to each sprite edge. Edge pixels are repeated outward to prevent texture bleeding.
Deduplicate pixel-identical sprites as aliases. Aliases reference the same atlas region, saving space.
Emit additional sheets when sprites overflow the first atlas. Produces
atlas_1.png, atlas_2.png, etc.Pivot points
Default pivot X coordinate (0.0-1.0) for all sprites. Requires
--pivot-y. Value of 0.0 is left edge, 1.0 is right edge.Default pivot Y coordinate (0.0-1.0) for all sprites. Requires
--pivot-x. Value of 0.0 is top edge, 1.0 is bottom edge.Scaling
Scale factor applied to output. For example, 0.5 produces a half-resolution atlas, 2.0 produces a double-resolution atlas.
Suffix appended to output filenames before the extension. For example,
@2x produces [email protected].Resampling filter used when scaling sprites.Values:
smooth- Lanczos3 resampling; high quality for general use (default)fast- Nearest-neighbor; crisp pixel art, no blurring
Output formats
Output data format for sprite metadata.Values:
json-hash- Generic JSON object keyed by sprite name (default)json-array- JSON array of frame objectsphaser3- Phaser 3 multi-atlas formatpixijs- PixiJS sprite sheet format
Output texture format.Values:
png- Lossless PNG (default)jpeg- 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 bit depth. Floyd-Steinberg dithering is applied when not rgba8888.Values:
rgba8888- 32-bit RGBA (8 bits per channel); no dithering (default)rgb888- 24-bit RGB (8 bits per channel, alpha forced to 255)rgb565- 16-bit RGB (5-6-5); Floyd-Steinberg dithering appliedrgba4444- 16-bit RGBA (4 bits per channel); Floyd-Steinberg dithering appliedrgba5551- 16-bit RGBA (5-5-5-1); Floyd-Steinberg dithering; alpha thresholded at 128alpha8- 8-bit alpha only
Premultiply RGB channels by alpha before compression. Improves blending quality in some engines.
Output
Successful packing prints atlas statistics:--multipack to emit multiple sheets instead of dropping sprites.
See also
- fastpack watch - Watch mode that repacks on file changes
- fastpack init - Create a project file
- Configuration reference - Complete .fpsheet format