# Tilemap - Retrieve tile's ID when mirrored

**URL:** https://community.aseprite.org/t/tilemap-retrieve-tiles-id-when-mirrored/21330
**Category:** Bug Reports
**Created:** [January 29, 2024, 10:24am UTC](https://community.aseprite.org/t/tilemap-retrieve-tiles-id-when-mirrored/21330 "2024-01-29T10:24:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![KingQuack](https://community.aseprite.org/user_avatar/community.aseprite.org/kingquack/32/17813_2.png) [@KingQuack](https://community.aseprite.org/u/KingQuack)
#### Post date: [January 29, 2024, 10:24am UTC](https://community.aseprite.org/t/tilemap-retrieve-tiles-id-when-mirrored/21330/1 "2024-01-29T10:24:06Z")

</div>

Hello,

Since the new version v1.3.2-x64 of aseprite, we can now generate a Tilemap with tile’s flip property.

But it seems that when I want to retrieve, through API, the ID of the tile in question, the ID is a very large number that doesn’t correspond to anything.

The method used to retrieve ID is: tilemap:getPixel(x, y) with X, and Y the tile position in the Tilemap.

 ![example](https://community.aseprite.org/uploads/default/original/3X/3/f/3fcb4fd41eb81015d887625e39cf2eb78e313f2e.png)

Is there a way to get the Tile ID and if it’s mirrored ?

Thanks in advance.

---

<div class="post-metadata">

### Author: ![behreandtjeremy](https://community.aseprite.org/user_avatar/community.aseprite.org/behreandtjeremy/32/6606_2.png) [@behreandtjeremy](https://community.aseprite.org/u/behreandtjeremy)
#### Post date: [January 29, 2024, 10:59am UTC](https://community.aseprite.org/t/tilemap-retrieve-tiles-id-when-mirrored/21330/2 "2024-01-29T10:59:57Z")

</div>

I’d try `app.pixelColor.tileI` and `app.pixelColor.tileF`, which decompose a map entry into its index and flipping flags. `app.pixelColor.tile` composes an index with its flipping flags to create a complete map entry.

> <https://github.com/aseprite/aseprite/blob/main/src/app/script/pixel_color_object.cpp#L74>

The flipping flags for X, Y and D can be found in the source code, as well as the logic for how the functions above work:

> <https://github.com/aseprite/aseprite/blob/main/src/doc/tile.h#L24>

The flags are the same as in Tiled, btw, which makes export nice and easy:

[https://doc.mapeditor.org/en/stable/reference/global-tile-ids/#gid-tile-flipping](https://doc.mapeditor.org/en/stable/reference/global-tile-ids/#gid-tile-flipping)

---

<div class="post-metadata">

### Author: ![KingQuack](https://community.aseprite.org/user_avatar/community.aseprite.org/kingquack/32/17813_2.png) [@KingQuack](https://community.aseprite.org/u/KingQuack)
#### Post date: [January 29, 2024, 12:59pm UTC](https://community.aseprite.org/t/tilemap-retrieve-tiles-id-when-mirrored/21330/3 "2024-01-29T12:59:59Z")

</div>

oh, this is very good !  
With app.pixelColor.tileI and app.pixelColor.tileF I can now retrieve all informations I need for my lua script.

Maybe the official API documentation will write this type of usage.  
Tiles management is still fairly new in software.

Thanks.
