split subcommand is the inverse of packing. It reads an atlas image and its data file, then writes each sprite back out as a separate PNG file. Use it to extract sprites from a legacy atlas, inspect packed output, or feed sprites into an editing tool.
Usage
<ATLAS>— Path to the packed atlas PNG<DATA>— Path to the JSON Hash data file--output-dir— Directory for extracted sprites (default:sprites)
CLI flags
| Flag | Description | Default |
|---|---|---|
-o, --output-dir <DIR> | Directory where extracted sprite PNGs are written | sprites |
Examples
Output structure
Extracted sprites are placed in subdirectories matching their sprite ID path:Technical details
Extraction process (split.rs:34-86)
Extraction process (split.rs:34-86)
The splitter reads the atlas PNG and JSON Hash data file. For each frame:
- Crops the atlas region using the
framerect - Rotates the sprite 270° if
rotatedis true - Restores the original canvas size if the sprite was trimmed by placing the cropped region at
spriteSourceSize.x, yon a canvas ofsourceSize.w × h - Writes the result to
<output_dir>/<id>.png
Trimmed sprite handling
Trimmed sprite handling
Sprites are extracted using the
frame rect from the data file, which points at the trimmed region in the atlas. When trimmed is true, the splitter reconstructs the full original dimensions including transparent padding by compositing the trimmed region onto a canvas of sourceSize dimensions at the spriteSourceSize offset.Alias sprite handling
Alias sprite handling
Alias sprites (those with an
aliasOf field) are written as separate files; each gets the pixels of the atlas frame they point to. The alias relationship is not preserved in the extracted files.TexturePacker compatibility
TexturePacker includes a similar “Unpack Sprites” command. Both tools extract sprites from theframe rect and handle trimmed sprite reconstruction in the same way.