A Python script to take a series of images/layers and turn them into a Tiled file along with a tileset.
I was working on a project and created a map with multiple layers (floor, walls, doors, objects, etc.) in a vector art program. When I wanted to import this into a tilemap program (Pyxel Editor, Tiled), I found that while they could both chop up the images into tiles (and PyxelEdit could even merge duplicates), it DID NOT AUTOMATICALLY CREATE LAYERS FOR THE IMAGES. So I had to create the art, then manually create the orientation of the tiles in the second tool. That seems a bit...inefficient.
Currently, it will do the following:
-
Import a series of images by a (glob) pattern or a specific set of file names.
-
Verify all the images are the same size.
-
Verify they are an even multiple of the tileWidth and tileHeight (once the cropping is done).
-
Chop up the images into a tileset of tileWidth x tileHeight size, removing duplicates. Duplicates are checked based on the eight cardinal "flips" that Tiled uses (flipX, flipY, flipDiagonal).
-
Generate an output tileset (named as an input).
-
Generate an output Tiled file (named as an input).
See the notes on check-ins to see future work and plans.