Skip to content

JSON Hash exporter

Output

Packrat writes one TexturePacker-style JSON Hash descriptor and one image per atlas page. Frames are stored in a frames object keyed by exported name.

text
atlas.json       atlas.png

Example output

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

json
{
  "frames": {
    "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

Use this as a generic interchange format or as input to a runtime that accepts the JSON Hash schema. For each frame, frame is the packed rectangle on the atlas page, sourceSize is the original frame size, and spriteSourceSize describes the trim offset within that original frame. Keep the atlas page image path in meta.image relative to the JSON file.

Packrat documentation