Computer Science Canada

Pygame Image transparencies

Author:  SNIPERDUDE [ Sun May 16, 2010 8:42 pm ]
Post subject:  Pygame Image transparencies

It's been a while since I've posted for help, but I've run into a problem that seems to be stumping me (I haven't been using python for too long, and even shorter for pygame). I can't seem to properly get an image to blit with proper transparencies. I've tried both *.convert() and *.convert_alpha() before you ask.

Relevant code (that is runnable with an example) attached in ZIP folder below.
Any help appreciated.

Author:  Draymire [ Mon May 17, 2010 12:01 pm ]
Post subject:  Re: Pygame Image transparencies

Try removing the *.convert() altogether. I ran it like this:
code:
img = pygame.image.load("test.png")

and it worked fine.

Author:  SNIPERDUDE [ Mon May 17, 2010 2:27 pm ]
Post subject:  RE:Pygame Image transparencies

Hmm, makes me wonder why everywhere else I see on the web over-emphasizes the use of the convert function.

Thanks for your help!

Author:  Draymire [ Mon May 17, 2010 3:34 pm ]
Post subject:  Re: Pygame Image transparencies

No problem, I see that too and i just ignore it and have never had a problem yet.

**hopes i didn't just jynx myself**

Author:  BBil [ Thu Nov 11, 2010 5:11 pm ]
Post subject:  RE:Pygame Image transparencies

well I'm not sure if this helps, seems like you've already solved the problem. Anyhow, in my experience with pygame I've used .covert_alpha() and it has worked for me. All that had to be done was make the whitespace of the image transparent and save it as a .png

Author:  SNIPERDUDE [ Thu Nov 11, 2010 8:39 pm ]
Post subject:  RE:Pygame Image transparencies

Thanks, I got it.


: