[Image-SIG] Where is the indexed PNG alpha table ?

Ray Pasco pascor at hotpop.com
Fri Jan 28 02:09:10 CET 2005

Subject: Re: [Image-SIG] Where is the indexed PNG alpha table ?
Date:        Thu, 27 Jan 2005 13:58:18 +1300
From:        Douglas Bagnall <douglas at paradise.net.nz>
To:          Ray Pasco <pascor at hotpop.com>
CC:          image-sig at python.org

Ray Pasco wrote:

> I am wondering how to get at the alpha layer table that goes along
> with an indexed PNG image.

I believe that alpha in an indexed PNG is not stored as a channel, but 
as indexed colours.  In other words, the index is not of RGB values, but 
of RGBA values.  If you only have full transparancy, there'll only be 
one index value for it, and PIL will probably do the right thing with

>>> im = Image.open('indexed.png').convert('RGBA')

but I'm not sure how it would cope with multiple semi-transparent values 
-- I don't know how to make such an image to test with.


I asked this because I just learned that indexed PNG images *can* have a 
separate "alpha" index table in parallel with the color index table.

"Indexed images with transparency actually contain
a table specifying the transparency of each indexed colour. However, the
size of that table can be less than the number of indexed colour, in which
case missing values are assumed fully opaque. The transparency table can
contain only one value, but in this case, it always correspond to the first
colour of the palette. It does not have to be fully transparent either. Any
value from 0 (fully transparent) to 255 (fully opaque) is allowed. See

Also see in section 4.4, first item e in:

Is this alpha index table not implemented in PIL (yet) ?

Ray Pasco

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/image-sig/attachments/20050127/ef815eaa/attachment.html

More information about the Image-SIG mailing list