Skip to content
NonlinearIdeas edited this page Dec 31, 2014 · 12 revisions

Map Tiler

The Map Tiler is a python script designed to turn a map constructed from multiple layers into a tileset and xml file that can be used in the Tiled Map Editor.


Features

  • Automatically merges duplicate tiles by checking for one of eight transformations (flipX, flipY, flipDiag).
  • Allows you to specify an rectangle in the input image to use for processing.
  • Allows you specify files individually on the command line or by a pattern or both.
  • Allows you to specify the output file names.
  • Generates tilesets as a power of 2 in width x height. You can force it to be square or not.
  • MIT Licensed

Usage

Usage: MapTiler.py [--tileWidth=WIDTH] [--tileHeight=HEIGHT] [--tileOffX=OFFX] [--tileOffY=OFFY] [--tileInsetX=INSETX] [--tileInsetY=INSETY] [--filePattern=PATTERN] [--outTileset=OUTTILESET] [--outTiled=OUTTILED] [--forceSquareTileset] [--verbose] [...] Options: layerImage A sequence of image files to be used as inputs. They will be processed and placed into the .tmx file in the order entered. Or sorted if a search pattern is used. --tileWidth=WIDTH The tile width in pixels. [Default: 64] --tileHeight=HEIGHT The tile height in pixels. [Default: 64] --tileOffX=OFFX Offset pixels in the image in the horizontal direction. May NOT be negative. [Default: 0] --tileOffY=OFFY Offset pixels in the image in the vertical direction. May NOT be negative. [Default: 0] --tileInsetX=INSETX Offset pixels from the right edge. [Default: 0] --tileInsetY=INSETY Offset pixels from the bottom edge. [Default: 0] --filePattern=PATTERN A glob pattern for image files. --outTileset=OUTTILESET The output tileset image file. [Default: tileset.png] --outTiled=OUTTILED The output Tiled file in .tmx format. [Default: tiled.tmx] --forceSquareTileset If present, the tileset image will be a square image. The output tileset image is always a power of 2 in size. --verbose If present, give output while working.


Dependencies

  • Uses the Python Image Library
  • Uses docopt for the options parsing. The file is included in the project.
Clone this wiki locally