Extract a Tileset from a Map Image: Tiled and Godot 4
Extract a tileset from a map image or screenshot: find the tile grid, keep each unique tile once, and rebuild the map in Tiled and a Godot 4 TileMapLayer.

You have a picture of a level and no tileset to go with it. It might be a mock-up you painted from tiles before the project had a map editor, a screenshot of your own old game whose project files are gone, or a map a teammate sent as one flat PNG. It looks right, but you can't change a single tile of it. To edit it in Tiled or Godot you need the tiles it was made from, and a map that says which tile goes where.
By hand it takes an afternoon and still goes wrong. You crop 16x16 squares and compare them by eye. Grass tiles that differ by one pixel look the same, and tiles that look different turn out to be one tile mirrored. Then you rebuild the level, cell by cell.
This guide shows how a map picture turns into a tileset, what breaks on the way, and how to do it in a minute with the Tileset Extractor. You can try it here while you read. Use it on maps you have the rights to: your own levels and maps built from packs you own.
How a map becomes a tileset
A tile map picture is a grid. Cut it at the right tile size, from the right starting pixel, and every cell is one tile. Keep each cell that doesn't match a tile already kept, lay the kept tiles out in rows, and that picture is the tileset. Write the map as tile numbers, row by row, and an editor can draw the picture again from it.

The hard part is the tile size and where the grid starts. The right grid is the one where cells repeat the most. Shift it by a pixel and the same grass tile gets cut in two different places, so far fewer cells match.
What goes wrong
- The grid is one pixel off. Almost every cell becomes a new tile, and the tileset has nearly as many tiles as the map has cells.
- The screenshot was saved scaled up. A 16 px game shown at 3x gives 48 px tiles of tripled pixels, and a blurred scale makes every copy slightly different.
- The picture is a JPEG. Two copies of the same tile differ by a few colour values, so every grass tile counts as its own.
- Mirrored copies are kept twice. A left wall and a right wall are often one tile flipped, so every fix has to be made twice.
- The edges are not whole tiles. A screenshot of a scrolled view starts and ends mid-tile.

The fast way: the Tileset Extractor
The Tileset Extractor does all of this in your browser. Your map is never uploaded.
- Drop your map. A level, a screenshot or a mock-up as PNG, GIF, JPEG or WebP, up to 8,192 pixels a side. Drop several maps of one game and they share one tileset. No map at hand? Try ours, a farm drawn with the tiles of Farm RPG.
- Check the grid it found. It tries the common tile sizes and tells you what it found, for example "Found 16 x 16 px tiles", plus where the grid starts if that isn't the top-left corner. A screenshot saved scaled up is read at its real size, and the Read at its real size box says by how much. If no clear grid stands out, you set the size: one click for 8, 16, 24, 32, 48 or 64, or any width and height up to 256. Grid starts across and Grid starts down move the grid a pixel at a time.
- Choose what counts as the same tile. Only exact copies, Mirrors count as one, or Mirrors and turns count as one. With mirrors on, a flipped copy is kept once and the map flips it back where it is used. Quarter turns need square tiles.
- Set the colour tolerance. Keep it on exact for pixel art. For a JPEG or a blurred screenshot, raise it (up to 96) and near copies count as one tile. When a picture is noisy, the tool picks a tolerance itself and says so. Leave fully clear cells empty keeps transparent areas out of the tileset.
- Check the result. It shows how many tiles came from how many cells and how many are used only once, then rebuilds the map from the tileset and tells you whether it comes out the same, pixel for pixel. Click a cell to see every place its tile is used. Mark tiles used only once outlines those in red, where a grid set one pixel off shows first.
- Lay out the tileset picture. Choose the columns, the order (As they appear or Most used first), and a margin and spacing of up to 32 px. Extrude the edges 1 px copies each tile's border pixels outward, so no seams show when the camera zooms. Every tile as its own PNG too adds single files.
- Download. Download the tileset (ZIP) gives you everything below. Tileset PNG gives the picture alone.
A very big map at a small tile size can pass 250,000 cells. The tool then asks for a bigger tile size, or for the picture to be read at its real size.
Every Gridwright asset pack, made to fit together, and all 44 tools for the fiddly work, with every new release, for $17 a month. Try it in your own game first: 3 days for $1 with every tool and up to 10 packs. Cancel any time.
Start: 3 days for $1 See everything it includesWhat is in the ZIP
- The tileset PNG, a Tiled tileset (
.tsx) and a Godot 4 TileSet (.tres) for it. - For each map: a
.tmxfor Tiled, a.tscnwith one TileMapLayer, and a.jsonwith the tile numbers row by row (-1 for an empty cell), each cell's flips if there are any, and how often each tile is used. - A README with the tile size and the grid each map was cut on.
Keep the files in one folder: the maps find the tileset, and the tileset finds its PNG.
Open the map in Tiled
- File > Open the map's
.tmx. Tiled loads the tileset beside it and draws your picture. - Mirrored and turned cells are saved with Tiled's own flip flags, so they show the right way round. While you paint with the Stamp Brush, X and Y flip the stamp and Z turns it.
- To use the same tiles in a new map, choose Map > Add External Tileset and pick the
.tsx.
Use it in Godot 4
The scene uses the TileMapLayer node, so it needs Godot 4.3 or later.
- Copy the folder into your project. Godot imports the PNG.
- Set Project Settings > Rendering > Textures > Canvas Textures > Default Texture Filter to Nearest, or the pixel art comes out blurred.
- Double-click the map's
.tscnin the FileSystem dock. The TileMapLayer draws your map, flipped tiles included. Drag the.tscninto your level scene to use it there. - To paint new levels with the same tiles, add a TileMapLayer node, load the
.tresinto its Tile Set property and paint from the TileMap panel at the bottom of the editor.
Godot's atlas sources have Use Texture Padding on by default, which already stops seams, so extruded edges matter most in engines that read the PNG directly.
If your game loads levels while it runs, the JSON is enough. Put this script on a TileMapLayer whose Tile Set is the .tres, and it draws the map from its JSON:
extends TileMapLayer
# Set Tile Set on this node to the .tres from the ZIP, and point this at a map's .json.
@export_file("*.json") var map_file := "res://maps/farm_map.json"
func _ready() -> void:
var data: Dictionary = JSON.parse_string(FileAccess.get_file_as_string(map_file))
var columns := int(data["tileset"]["columns"])
var tiles: Array = data["tiles"]
var turns: Array = data.get("transforms", [])
for y in tiles.size():
for x in tiles[y].size():
var id := int(tiles[y][x])
if id < 0:
continue # an empty cell
var flags := 0
if not turns.is_empty():
var t := int(turns[y][x])
if t & 1: flags |= TileSetAtlasSource.TRANSFORM_FLIP_H
if t & 2: flags |= TileSetAtlasSource.TRANSFORM_FLIP_V
if t & 4: flags |= TileSetAtlasSource.TRANSFORM_TRANSPOSE
set_cell(Vector2i(x, y), 0, Vector2i(id % columns, floori(float(id) / columns)), flags)
The transforms grid is only in the JSON when the map uses a mirrored or turned tile, which is why the script checks for it.
When the result looks wrong
- Almost every cell is a new tile. The grid is off. Press Find the tile size again, or move the grid start a pixel at a time until the count drops.
- The tiles are two or three times too big. Tick Read at its real size.
- Grass tiles that look the same are kept apart. Raise the colour tolerance a step at a time.
- The rebuild says some pixels come out different. The tolerance merged near colours. Lower it if you need the map exact.
FAQ
Can I extract a tileset from a screenshot?
Yes. A screenshot saved at 2x, 3x or 4x is read at its real size, so the tiles come out pixel for pixel, and the colour tolerance handles a JPEG.
Does it work on a painted background?
Only if the background is built from tiles. A painting or a photo has no grid that repeats, and the tool tells you that no clear grid was found.
Turn your map into tiles today
Open the Tileset Extractor, drop your map and check that the rebuild comes out the same. If you'd rather start from tiles made to fit together, the Top-Down Tileset has 16x16 grass, sand, snow, water and cliffs with real autotiles, and Farm RPG is the pack our example farm was drawn with. Both are part of Gridwright: 44 tools and 150 asset packs, 3 days for $1, then $17 a month.
Every Gridwright asset pack, made to fit together, and all 44 tools for the fiddly work, with every new release, for $17 a month. Try it in your own game first: 3 days for $1 with every tool and up to 10 packs. Cancel any time.
Start: 3 days for $1 See everything it includes