Can I count on image "width" and "height" attributes in TMX files?

Looking at the file format for TMX files I see that on the the image element that “width” and “height” or optional attributes.

I understand that Tiled can load TMX files without those attributes but I’m wondering if I can take for granted that files that are saved in Tiled will always have width and height set?

(This is for Tiled2Unity and I’m trying to get the width and height on an image without having to load the image first, if that helps.)

Yes, since Tiled 0.6 it is always storing the width and height the tileset image had when the map was opened in Tiled. This is of course no guarantee that the image still has that size. :slight_smile:

For image layer images, this information was added much later (in Tiled 0.15.2). This was only for consistency, because the reason this information is there at all was actually just for Tiled to be able to adjust tile indices in case the image is expanded.

Excellent. Thanks, bjorn.