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

Joao S. O. Bueno Calligaris gwidion at mpc.com.br
Mon Jan 31 15:16:54 CET 2005


I actually have been working in a Python plug-in for the GIMP to be 
able to save indexed PNGs with more than one transp. level.

I do not use PIL at all, instead, I rely on teh GIMP to save tjhe PNG, 
na dthem, open the PNG as a binary file, according to the PNG specs, 
and write out the transparency info.

I do n ot recall now if there is more than a way of doing this (like 
having a 4 component palette). But what my progra does is write a 256 
(or less) byte separate chiunk (named "tRNS" within the png), with 
transparency information for each color on the palette.

I hope this helps.

The plug-in is in 'maintanance' right now - but if anyone here need 
it, I think I can fix it early next week. Ah, I shall have a working 
- though slow - version somewere.



On Sunday 30 January 2005 07:13, Douglas Bagnall wrote:
> I wrote:
> >> In other words, the index is
> >> not of RGB values, but of RGBA values.
> Ray Pasco wrote:
> > 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.
> Yes, and these two sentences amount to the same thing -- "in
> parallel" is an implementation detail of the index.  You don't get
> more information out of it.
> If you have such an image (I can't seem to make one with either the
> Gimp
> or PIL), have you tried:
>  >>> im = Image.open('indexed.png').convert('RGBA')
>  >>> r, g, b, a = im.split()
>  >>> a.save('alpha.png')
> alpha.png should be greyscale image containing only the alpha
> information from the original image.
> cheers,
> Douglas
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig

More information about the Image-SIG mailing list