export_spritesheet_packed
Export a packed sprite sheet for game engines: trim frames, extrude edges to stop tile seams, merge duplicate frames, and write optional JSON metadata.
Instructions
Export a sprite sheet with the controls a game engine needs: extrude, dedupe, trim.
The sibling of `export_spritesheet`, which goes through the Aseprite CLI. This one
drives the editor's own export command, which the CLI flags do not fully reach, and
adds three things that matter when the sheet is going into an engine rather than into
a preview:
Args:
output: Destination sheet image (.png).
sheet_type: one of horizontal, vertical, rows, columns, packed (the default).
trim: Trim each frame to its drawn pixels before packing, so empty margins cost
no sheet space. The frame rectangles in the data file say where each frame
went and how much was trimmed, so an engine can still place it correctly.
extrude: Duplicate each frame's edge pixels one pixel outwards around its cell.
This is the fix for the thin seam or transparent line that appears between
tiles in Unity, Godot or a shader at non-integer zoom: the sampler reads
half a texel past the frame's edge, and without extrude that is whatever the
neighbouring frame or empty space holds. The frame rectangle in the data file
still names the frame itself, not the border.
merge_duplicates: Give identical frames one rectangle in the sheet instead of a
copy each, which is what shrinks a sheet full of held poses. Identical by
pixels, so it catches both a duplicated frame and a linked cel. A packed
sheet does this anyway and the result says so.
padding: Pixels of padding around and between frames, as `export_spritesheet`.
Padding separates frames; extrude fills the gap at the frame's own edge.
They solve different halves of the same bleeding problem and compose.
data_output: Optional .json path for the sheet metadata, which also carries the
layer, tag and slice lists.
data_format: "json-array" (the default when `data_output` is given) or
"json-hash". The array form lists frames in order, which an engine indexing
by frame number wants; the hash form keys them by name, which a loader
looking frames up by name wants. The tag section is called `frameTags` in
both.
overwrite: Replace existing output(s) (default False = no-clobber). When
`data_output` is given, both files are checked before anything is written.
The source sprite is not modified: verified, the file's bytes and frame count are the
same afterwards, including with trim and extrude set.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| trim | No | Default: false. | |
| output | Yes | ||
| extrude | No | Default: false. | |
| padding | No | Default: 0. | |
| filename | Yes | ||
| overwrite | No | Default: false. | |
| sheet_type | No | Default: "packed". | packed |
| data_format | No | ||
| data_output | No | ||
| merge_duplicates | No | Default: false. |