Pygame set_colorkey transparency issues

Posted by Nathan Chowning on Game Development See other posts from Game Development or by Nathan Chowning
Published on 2013-01-22T22:57:51Z Indexed on 2013/10/20 4:15 UTC
Read the original article Hit count: 308

Filed under:
|
|
|

I'm having a strange issue that I cannot seem to remedy. I am doing some prototyping with Pygame on a desktop running windows and a laptop running OS X. Both are running python v2.7.3 (installed via homebrew for the Macbook) and pygame v1.9.1.

For transparency, I have been using set_colorkey with a transparency color of (255, 0, 255). Here is the applicable code:

transColor = pygame.Color(255, 0, 255)
image = pygame.image.load(playerPath + "idle.png").convert()
image.set_colorkey(transColor)

This works flawlessly on my windows machine. On my laptop, it does not work. It just shows the hideous magenta color. Here's the strange part. If I change the transColor to (0, 0, 0), all black pixels in my images are transparent. Has anyone run into this issue before?

© Game Development or respective owner

Related posts about python

Related posts about pygame