How to turn a level image into a tilemap
- Drop a PNG of your level at its original 1× scale.
- Enter the tile size. If the map doesn't start at the image's top-left corner, set the offsets.
- Check the rebuilt map below the tileset. It should look exactly like your image. The number of unique tiles tells you how big the tileset is.
- Download the ZIP and open the
.tmjin Tiled, or read the CSV in your own engine.
When this is useful
- Mockups to real levels: artists often paint a level in one canvas. Extract the tiles to turn it into an editable map.
- Optimizing tilesets: remove duplicate tiles that crept into a tileset, and measure how many distinct tiles a scene really needs.
- Game jams: paint the first level in your pixel editor, then convert it so later levels can be built in Tiled from the same tiles.
Reading the CSV in code
// each line is a row; 0 = empty, n = tile n-1 in the tileset (left-to-right, top-to-bottom)
const rows = csv.trim().split('\n').map((r) => r.split(',').map(Number));
rows.forEach((row, y) => row.forEach((gid, x) => {
if (!gid) return;
const flipH = gid & 0x80000000, flipV = gid & 0x40000000;
const tile = (gid & 0x1fffffff) - 1;
drawTile(tile, x, y, flipH, flipV);
}));
The flip bits only appear when Reuse flipped tiles is turned on.