[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

RE: [pygame] Alpha Channel



I've used PNGs saved from Photoshop as 24-bit with transparency enabled.

From there, using Image.convert() will automatically use RGBA, unless you
specify otherwise.

The easiest way to test if the loaded/converted image has an alpha channel
is to use Image.set_alpha(x) where x is a value from 0 to 255.

If your image isn't too complex (ie: has no anti-aliasing on its exterior
edges), you should consider using Image.set_colorkey(color) (where color is
an RGB tuple). The most generic colorkey to use is 255, 0, 255 which equates
to hot pink. However, using this method won't give you the ability to use
fade-like animation effects.

HTH


~Chris

-----Original Message-----
From: owner-pygame-users@xxxxxxxx [mailto:owner-pygame-users@xxxxxxxx]On
Behalf Of AMMayberry1@xxxxxxxxxxxx
Sent: Thursday, April 20, 2006 14:26
To: pygame-users@xxxxxxxx
Subject: [pygame] Alpha Channel


Hello all,
Is there a way to load an image in pygame, and still maintain its alpha
channel? If so, what file type do I need to use for the image?
Thanks in advance.
-Marshall




CONFIDENTIAL NOTICE: This email including any attachments, contains 
confidential information belonging to the sender. It may also be 
privileged or otherwise protected by work product immunity or other 
legal rules. This information is intended only for the use of the 
individual or entity named above.  If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, 
distribution or the taking of any action in reliance on the contents 
of this emailed information is strictly prohibited.  If you have 
received this email in error, please immediately notify us by 
reply email of the error and then delete this email immediately.