Hi there,
I was looking for something to convert *.png map files into tmx files for game recreation purposes.
And I could not find anything working or “ready to go”, so I have made my own and I want to share it with You all.
using by the same command
java -jar Img2Tmx.jar tileWidth tileHeight TileSet.png MapFile.png
To get tiles in new layers put tile’s tile set number in txt file attached to program (they need to be in the same folder as jar file).
numbers needs to be in 1 column like:
Cool little tool. Maybe as a next step it could autogenerate the tileset from tiles in the image? You already can recognize if the tile exists, so you can use that code to prevent generation of dupe tiles (if tile is in set, use it, if it isn’t create it as a new one and add at the end of the tileset, creating new row if necessary).
Cheers,
It should be easy to do. Although it brings some issues.
Tile set would be populated with tiles that not suppose to be there, like overlapping-transparent tiles or artifacts.
Also would be a mess to look at it.
I prefer to handcraft tile set by adding necessary tiles.
But I think I will implement auto generation for purpose of to get started.
Thanks. The reason I’ve asked for this is that many emulators allow for map export, layer by layer so overlaped tiles aren’t a problem. Also not everyone has technical know-how to dump the tilesets from a ROM (especially if they’re using any sort of compression to fit more on the cartridge), so generating tiles from screenshots is a next best thing. As for artifacts - you shouldn’t generate your map from a JPG anyway and some digital camera manufacturers have even started using PNGs for the camera because they have higher quality than JPGs and are still small, so JPGs in future will stop being used for photos as well.
Finally, the tileset looking like a mess, well that’s a tradeoff you may want to live with if you can’t track original set down and have to generate it from screenshots. Certainly beats sitting for hours and manually ripping tiles from screenshots.
Nice tool! It’s an often requested feature so eventually I do hope to get around to building this right into Tiled as some kind of “import map from image” feature.
Btw, I’m a bit wary of running binaries (which includes .jars), since there is no way to know what it’ll do. What about publishing the source code?
Thanks,
It would be useful feature, there are still planty people working on old games.
Providing *.jar was on purpose to avoid installing frameworks/libraries/compilators, but I understand Your worries.
I have made it as a tool for my project, therefore code is not elegant. But I will put it on github once I get myself to clean it up.