How do I remove tiles from a .tsx tileset?

Hi, very new to Tiled! (Just downloaded it today)

I’m trying to figure out how to delete a tile from a .tsx. I attempted to simply remove it from the original image the tileset is based on, but I ended up with a white tile.

I see there’s a “Remove tiles” button, but unfortunately it’s greyed out. I’m curious if there’s something I’m missing or some kind of setting that’s enable that prevents me from removing tiles. I don’t want to have to redo my terrain set, or I’d just create a new tileset file all together.

Thanks!

The “remove tiles” button is only available for Image Collection tilesets where each tile is its own image. It sounds like you probably have a “Based on Tileset Image” tileset where all the tiles are in a single image? In this case, you can edit the image. If you make the image smaller (so it has fewer tiles than before), Tiled will show white placeholders as you describe, but as long as these don’t include any metadata (terrains, custom properties, animations, etc), these placeholders will disappear next time you load this tileset.

Yep, I based the file on a tileset image. I was worried about the white tile after editing the image, but seems it’s nothing to worry about. Thanks for such a quick reply! This answers my question.

Is it possible to ignore empty tiles? Specifically to not generate tile id’s for tiles that are fully transparent. I have metadata that I’m trying to use with json tilemaps and tilesets. That metadata uses ids based on the order of used tiles.
For example an image that is 16x16 tiles, but I’ve only filled an 8x12 tile grid and the rest are empty. I would like to have the 8x12 grid have ids from 0 to 95 or 1 to 96. I can do this with math, but it feels weird. Especially when I’m in the editor and have a bunch of empty tiles when I’m using multiple tilesets like this.

No. In a “Based on Tileset Image” tileset, tile IDs are based on location in the tileset, ignoring “empty” tiles would break things if the image ever changes.

You could use an Image Collection instead. Though the “traditional” Image Collection uses a separate image for each tile, there’s nothing stopping you from using the same image for every tile, and defining a different sub-rect of that image for each one. This would be very tedious to do manually, but you could write a Tiled script to automate the creation of such tilesets. The same script could skip over empty tiles.

I think the best solution, however, would be to use your tilesets as-is, and match your metadata after the fact. That way, if you add tiles to the currently-unused areas, the tile IDs will not break, and they will remain sequential (Image Collection IDs can be non-sequential if tiles are removed, and don’t necessarily correspond to tile position in the image). If your tiles are always using some NxM subregion of the tileset you’re not worried about singleton empty tiles within that region, you could even store that region’s dimensions as custom properties on the tileset, so your calculations later can be very simple, with no need to check the image data at runtime or load time. Tiled scripting could be used to dynamically update these properties if you expect them to change.

In the future, please open a new thread instead of posting a barely-related question in an existing thread.