Hi all. :)

I'm having trouble with pygame, images and transparency.
Lets say I have an image...a circle to keep it simple (for example only).

What I want is to be able to draw the image, but with only the circle showing (ie. not a white box around it). Oh and it's png (png ftw :D).

I've tried the following


image = pygame.image.load('example.png')

#it was suggested to me by someone, but I didn't think it would work...but it didn't.


image = pygame.image.load('example.png')
image.set_colorkey((255, 255, 255)) #White, for example
#Fail -_-


I had been using paint, but I went on Paint.net, and cut out around the main image, and deleted the rest to get the checkbox (transparent) thingy. Then I loaded this pic. It didn't work.

I think colorkey is what I need, but I'm not sure how to use it on images, cos I could only find a thing on using it with surfaces.

Can anyone show me how to get transparent image backgrounds? O_o


convert_alpha() returns a new surface that you need to save over your old one.

image = pygame.image.load('example.png')
    image = image.convert_alpha()

It's much more efficient than setting a colorkey because it converts the image to Pygame's native blitting format.

This question has already been answered. Start a new discussion instead.