Skip to main content
The JSON Hash format writes atlas metadata as a single JSON object. Each sprite frame is a key in the top-level frames object. The key is the sprite ID — the source path relative to the sprite root, without file extension. This is the default output format and matches TexturePacker’s JSON Hash layout exactly.

Usage

fastpack pack sprites/ --data-format json-hash

Output format

Output for a two-sprite atlas:
{
  "frames": {
    "player/idle": {
      "frame": { "x": 2, "y": 2, "w": 64, "h": 96 },
      "rotated": false,
      "trimmed": true,
      "spriteSourceSize": { "x": 4, "y": 0, "w": 64, "h": 96 },
      "sourceSize": { "w": 72, "h": 96 }
    },
    "ui/button": {
      "frame": { "x": 68, "y": 2, "w": 48, "h": 32 },
      "rotated": false,
      "trimmed": false,
      "spriteSourceSize": { "x": 0, "y": 0, "w": 48, "h": 32 },
      "sourceSize": { "w": 48, "h": 32 }
    }
  },
  "meta": {
    "app": "FastPack",
    "version": "1.0",
    "image": "atlas.png",
    "format": "RGBA8888",
    "size": { "w": 256, "h": 128 },
    "scale": "1"
  }
}

Schema reference

Frame object

frame
object
required
Rectangle in the atlas texture
x
number
X position in pixels
y
number
Y position in pixels
w
number
Width in pixels
h
number
Height in pixels
rotated
boolean
required
true when the sprite was rotated 90° clockwise to fit. When reading a rotated frame, swap w and h from frame to get the display dimensions.
trimmed
boolean
required
true when the sprite was packed with TrimMode::Trim, Crop, CropKeepPos, or Polygon. It is false for TrimMode::None.
spriteSourceSize
object
required
Frame’s position and size relative to the original source image. x and y are the offset of the trimmed region within the original. For CropKeepPos trim mode these can be negative. w and h match frame.w and frame.h (the packed size, not the source size).
x
number
X offset (can be negative for CropKeepPos)
y
number
Y offset (can be negative for CropKeepPos)
w
number
Width in pixels
h
number
Height in pixels
sourceSize
object
required
Full original image dimensions before any trimming
w
number
Original width in pixels
h
number
Original height in pixels
pivot
object
Optional pivot point for the sprite (0.0–1.0 range)
x
number
Pivot X coordinate
y
number
Pivot Y coordinate
ninePatch
object
Optional 9-patch border dimensions
top
number
Top border size
right
number
Right border size
bottom
number
Bottom border size
left
number
Left border size
aliasOf
string
When alias detection is enabled, this field points to the original sprite’s ID for duplicate sprites

Meta object

meta
object
required
Atlas metadata
app
string
Always "FastPack"
version
string
Format version ("1.0")
image
string
Texture filename
format
string
Pixel format (e.g., "RGBA8888")
size
object
Atlas dimensions
w
number
Width in pixels
h
number
Height in pixels
scale
string
Scale factor used during packing (e.g., "1", "0.5", "2")

TexturePacker compatibility

The output structure matches TexturePacker’s JSON Hash format. Sprite IDs use forward slashes as path separators regardless of OS. The meta.app field reads "FastPack" instead of "TexturePacker", which engines ignoring the app field will not notice.
Engines that parse spriteSourceSize.x/.y as signed integers handle CropKeepPos negative offsets. Engines expecting only unsigned values may misread them — check your engine’s loader before using CropKeepPos.

Technical notes

Frame keys are inserted in atlas frame order (largest-area-first processing order, as produced by the packer). JSON object key ordering is not guaranteed by spec; load-time parsers should treat frames as an unordered map.

Build docs developers (and LLMs) love