Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Pygame Image transparencies
Index -> Programming, Python -> Python Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
SNIPERDUDE




PostPosted: 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.



transparency help.zip
 Description:
Code and test image. Requires Pygame.

Download
 Filename:  transparency help.zip
 Filesize:  911 Bytes
 Downloaded:  185 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Draymire




PostPosted: 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.



test.png
 Description:
 Filesize:  1.77 KB
 Viewed:  4735 Time(s)

test.png


SNIPERDUDE




PostPosted: 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!
Draymire




PostPosted: 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**
BBil




PostPosted: 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
SNIPERDUDE




PostPosted: Thu Nov 11, 2010 8:39 pm   Post subject: RE:Pygame Image transparencies

Thanks, I got it.
Display posts from previous:   
   Index -> Programming, Python -> Python Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: