Subject: Re: [Image-SIG] Where is the indexed PNG alpha table ? Date: Thu, 27 Jan 2005 13:58:18 +1300 From: Douglas Bagnall <[EMAIL PROTECTED]> To: Ray Pasco <[EMAIL PROTECTED]> CC: image-sig@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. douglas 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 http://www.libpng.org/pub/png/spec/iso/index-object.html#11tRNS". Also see in section 4.4, first item e in: http://www.libpng.org/pub/png/spec/iso/index-object.html#4Concepts.PNGImage Is this alpha index table not implemented in PIL (yet) ? Ray Pasco |
_______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig