Skip to content

JSON Array exporter

Output

Packrat writes one JSON descriptor and one image per atlas page. Frames are stored as objects in a frames array, each with a filename and the standard frame metadata.

text
atlas.json       atlas.png

Example output

The numeric coordinates below are illustrative. A one-frame JSON Array export has this shape:

json
{
  "frames": [
    {
      "filename": "player_0001",
      "frame": { "x": 128, "y": 64, "w": 40, "h": 48 },
      "trimmed": true,
      "spriteSourceSize": { "x": 12, "y": 8, "w": 40, "h": 48 },
      "sourceSize": { "w": 64, "h": 64 }
    }
  ],
  "meta": {
    "app": "https://www.codeandweb.com/texturepacker",
    "version": "1.0",
    "image": "atlas.png",
    "format": "RGBA8888",
    "size": { "w": 512, "h": 512 },
    "scale": "1"
  }
}

Integrate

Parse the array and index frames by filename or by your own asset catalog. Use frame for sampling the atlas page, sourceSize for the original frame size, and spriteSourceSize for the trim offset. Keep each image beside its JSON descriptor.

Packrat documentation