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

Ray Pasco pascor at hotpop.com
Thu Jan 27 02:33:16 CET 2005



-------- Original Message --------
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
References: 	<41F82308.9030507 at hotpop.com>



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.


douglas

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 colours, 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
http://www.libpng.org/pub/png/spec/iso/index-object.html#11tRNS

Ray


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/image-sig/attachments/20050126/744e64e6/attachment.htm


More information about the Image-SIG mailing list