Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > png transparency with PIL

Reply
Thread Tools

png transparency with PIL

 
 
Robin Becker
Guest
Posts: n/a
 
      11-23-2007
I'm trying to determine the transparency information for a png image. With gif
images I can determine the colour that is used for transparent areas using
im.info['transparency']. For the png images of interest there is no such entry
in the info dict. I assume that's because of the way png does transparency. I'm
guessing I need the alpha channel, but is there a way to get hold of it?
--
Robin Becker

 
Reply With Quote
 
 
 
 
Bjoern Schliessmann
Guest
Posts: n/a
 
      11-23-2007
Robin Becker wrote:

> I'm trying to determine the transparency information for a png
> image. With gif images I can determine the colour that is used for
> transparent areas using im.info['transparency']. For the png
> images of interest there is no such entry in the info dict. I
> assume that's because of the way png does transparency. I'm
> guessing I need the alpha channel, but is there a way to get hold
> of it?


For accessing the alpha channel, there is an RGBA mode for PNG
files:

http://www.pythonware.com/library/pi...format-png.htm

Regards,


Björn

--
BOFH excuse #58:

high pressure system failure

 
Reply With Quote
 
 
 
 
Robin Becker
Guest
Posts: n/a
 
      11-23-2007
Bjoern Schliessmann wrote:
> Robin Becker wrote:
>
>> I'm trying to determine the transparency information for a png

..........
>> guessing I need the alpha channel, but is there a way to get hold
>> of it?

>
> For accessing the alpha channel, there is an RGBA mode for PNG
> files:
>
> http://www.pythonware.com/library/pi...format-png.htm
>

........

that sounds like what I need.
--
Robin Becker
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a 24-bit PNG with binary transparency? Leif K-Brooks HTML 7 07-20-2009 09:40 AM
PNG transparency support Jeff HTML 12 03-06-2008 08:03 AM
Problem with transparency in png images on Mac OS X kasper@kau.dk Java 4 04-05-2006 12:41 PM
PIL 1.1.4 paste PNG's with transparency problem Caleb Hattingh Python 2 12-01-2004 02:39 AM
PNG graphics transparency Jens Lenge HTML 9 10-15-2004 06:48 PM



Advertisments