How can I export a layer to PNG

Hello,

I am trying to use Unity with TilED and so far everything is well and good. However, I encountered a point where I need to export each layer in my map as PNG file. Is there a way to do this in TilED?

Thank you very much in advance!

First of all, are you really sure you want to do this? Unless your map is quite small (like no bigger than the screen), it’ll be much more efficient to export it as a mesh using Tiled2Unity for example.

In Tiled you can choose File -> Export as Image… for each layer, making sure only the layer you want to export is visible and that “Only include visible layers” is checked. But for many maps or many layers, this will get tedious fast.

Another way is to use the tmxrasterizer command-line tool that ships with Tiled. In combination with the --ignore-visibility and --hide-layer options it may allow you to automate the process, in case you have a fixed set of layers.

In the future, I expect this kind of thing can be done with a small user-script to automate the process. But I still need to make Tiled scriptable.

I did export the map as one mesh using Tiled2Unity. Unfortunately it is causing all sorts of sorting problems when using certain add-ons. Adventure Creator is one. So I thought instead of just banging my head trying to solve the problem, I’d just export each layer as a separate PNG and do the sorting manually through AC’s sorting function. I didn’t think there would be that much of a performance hit. But then you say that… so I will go back and try to fix it.

Thanks for the reply :slightly_smiling:

Doesn’t this defeat the purpose of a tileset/atlas? Just curious that sounds very strange.