Disclosure: This article was generated with AI for the FrameSprite team, which has a commercial interest in FrameSprite. It received a separate AI editorial review against the cited sources. Executed synthetic fixtures are identified with their runtime and limits; no other editor, engine, production or performance test is implied.
Treat a tilemap image's pixel value as a packed tile entry, rather than a plain tileset index. A flipped instance can carry transform bits in the same integer. Extract the index and flags separately before looking up the tile image; preserve the flags when reconstructing the map.
Key Takeaways
- Mirroring does not create a new tileset image index.
- Store both the recovered index and the cell's transform flags.
- Test with an asymmetric tile so a lost flip is visible.
Recognize the packed value
An Aseprite user reported exactly this symptom in the mirrored-tile scripting discussion: an ordinary tile number became a much larger integer after mirroring. This is evidence of the task, not a measurement of its frequency.
The current official tile representation defines an index mask of 0x1fffffff and three high-bit transform flags. The Lua binding implementation registers app.pixelColor.tileI, tileF, and the named flip constants. These details are in the maintainer's source even though the published pixelColor reference does not enumerate all of them.
For a tile whose index is 23, adding X and Y flip flags produces the packed integer 3221225495. Looking for tileset image number 3221225495 will fail. Recovering index 23 is necessary, but discarding the flags would draw its original orientation.
Decode a cell in an export script
Read the tilemap cel's image at tile coordinates, not at the pixel coordinates of the painted tileset artwork. Keep a feature check so an unsupported installed API fails clearly:
local cel = app.activeCel
assert(cel and cel.layer.isTilemap, "Select a tilemap cel")
local pc = app.pixelColor
assert(pc.tileI and pc.tileF, "This build lacks tile decoding helpers")
local tileX, tileY = 0, 0
local packed = cel.image:getPixel(tileX, tileY)
local index = pc.tileI(packed)
local flags = pc.tileF(packed)
print("index", index, "flags", flags)
Use a tile coordinate that exists in the cel image. Cel placement and the tileset's tile dimensions still matter when turning that local cell into a document or runtime position. Exporting the image collection alone follows a different task: export just an Aseprite tileset.
Verify identity and orientation separately
The following independent Python arithmetic reproduces the chosen packed entry:
packed = 23 | 0x80000000 | 0x40000000
index = packed & 0x1fffffff
flags = packed & 0xe0000000
assert index == 23
assert flags == 3221225472
Our Python 3.12.10/Pillow 13.0.0 fixture passed those assertions. Its asymmetric triangle is flipped horizontally and vertically in the right-hand panel:
The record, input, and script preserve the numbers. No Aseprite Lua execution was performed. This fixture does not test diagonal-flip ordering or a destination engine's transform conventions.
Keep the destination's ID system explicit
Do not copy packed Aseprite integers into another map format merely because it also uses high-bit flags. Confirm its index origin, empty-cell value, tileset addressing, and transform order. Write a translation layer and test original, X-only, Y-only, and diagonal cases against the actual destination.
Likewise, a valid index can point to the wrong artwork after a tileset edit. The tileset reorder and remap guide addresses identity changes rather than transform decoding. Finally, verify the map's coordinate convention with the Y-origin checklist. Correct flags cannot repair a flipped map coordinate system.
Prepared by the FrameSprite Workflow Team. AI-assisted technical writing with synthetic packed-value checks; no Aseprite scripting or engine import was executed. Editorial method ยท Corrections.

Top comments (0)