Problem render alpha tiled -> pyTMX

I have problem render from Tiles to PyTMX, the alpha channel was not repected.
I use Python 3.6 and pytmx 3.21.6
Tileset come form
did anyone have the same problem? Thanks


The alpha channel indeed seems to be the problem here. You may want to notify the creator of the pytmx about this. I also suggest to check the tileset to make sure the white parts are fully transparent, and not have an opacity value of 1 or something.

1 Like

Ok Thanks.
The tilset are fully transparent. I don’t know why it do this.
I notify the creator of pytmx on github.

To see if this is a problem with PyTMX or with Pygame itself, I would try and see what happens if you simply render the tileset image to the screen.

But it’s rather weird that the transparency would be broken for only some of the tiles. Please let us know when you found out what the problem was!

The only solution i found is to fill background with white color and put trans=“ffffff”, i lose the transparence.

Did you try just rendering the tileset image, bypassing PyTMX? Is Pygame able to render the image correctly with alpha channel?

We found solution with author of Pytmx. !!

We must remove TRANS=“xxxxx” of TMX file.

Why Tiled write TRANS every time, i d’ont know.

Hmm, actually it shouldn’t if no transparent color is set. If you did not set a transparent color but it does write one, please let me know.

Ho ok!! every time when i imported tiles png, i clicked on “select transparent color” button!
May be update Tiled for detect automaticly when there is alpha layer on png and disable button.

I guess that could be helpful, but I don’t think I can guarantee that nobody is using images with an alpha channel AND still selects a transparent color in addition…

In any case I’m glad you found the problem. :slight_smile: