The smart tilemap image minifier for Tiled & GBA.
smint takes in a Tiled tilemap file (.tmj) and produces an identical output map, but with every tileset image in the map minimised to take up the least possible space on GBA. The minification removes all duplicate tiles (inclusive of HFLIP and/or VFLIP), but leaves the final map looking identical.
This way, you can download a nice-looking tileset off the internet and build a map with it directly, without having to first minimise the tiles into an ugly mess which might fit in VRAM, but is annoying to work with from a level design perspective.
Suggested to use alongside the tiled-to-gba-export plugin.
./smint ./CastleMap.tmj
Reduced number of tiles in 'castle.tsj': 2312->526 (-77%)
Wrote minimised tile image to 'castle_min.png'.
Map 'CastleMap.tmj' successfully minimised to 'CastleMap_min.tmj'.
Note: You can also add the argument --remove-unused-tiles
(or -rut
) to further reduce the number of tiles, by removing any tiles in the linked tilesets that aren't used anywhere in the input map.
Tileset pictured is by Jason Perry from timefantasy.net.
smint parses the map file (.tmj), and finds all tileset (.tsj) files pointed to by it, and each image file pointed to in turn by the tilesets. Each image is scanned for duplicate 8x8 tiles, and an output image (always .png) is produced where all tiles are unique. A new tileset file is created that points to the new image. Finally, a new map file is created that updates all tileset paths and Tile IDs to correspond to the new minimised tilesets.
Any tileset in the input map that is already minimal (i.e. contains no duplicate tiles) is left untouched, and if this is the case for all tilesets in the map, no output map is produced.
There's a Windows x86_64 binary on the releases page.
Run build.bat
in a shell initialised with the VS build environment (e.g. Developer Powershell for VS).
chmod +x ./build.sh
./build.sh
Unix support has been much less tested, but seems to run fine in my WSL1 environment.
- Only supports JSON-based Tiled tilemaps (.tmj) and tilesets (.tsj) at the moment.
- Only supports path names up to Windows's default MAX_PATH of 260 characters.
- If an image contains an alpha channel, this is ignored when checking for tile duplicates, but will still be present in the output image. (GBA does not support alpha so seemed like a sensible solution, but might be worth keeping in mind.)