[Image-SIG] Support for semi-transparent in PNG palette
sierra_mtnview at sbcglobal.net
Sat Apr 11 20:22:16 CEST 2009
I a bit tardy as explained by my Spam msg just posted. This is a very
difficult list to post to for several reasons just mentioned in a msg I
posted a few minutes ago.
Interesting. Thanks. I did get what I was looking for (just posted a few
mins ago), but this has some good twists.
Denilson Figueiredo de Sá wrote:
> Hello, I think I found a bug/limitation in PIL.
> If I have a PNG with palette, and with semi-transparent colors at that
> palette, then PIL will ignore the semi-transparent information. In
> other words, it will always load the palette as RGB, instead of RGBA.
> Let's reproduce the bug, step-by-step:
> 1. Create an RGBA image using Gimp. Or, even easier, download this one
> I created:
> 2. Convert that image to RGBA palette. What I've done was:
> cp pil_rgba.png pil_palette.png
> optipng -o7 pil_palette.png
> You can download optipng at http://optipng.sourceforge.net/
> Or you can download the converted image here:
> 3. Try opening it using PIL, convert back to RGBA, and save as PNG:
> from PIL import Image
> f = Image.open("pil_palette.png")
> print f.palette.mode # This will print RGB, but should be RGBA
> f = f.convert("RGBA")
> Or you can download it from here:
> == What did I expect? ==
> I expected that PIL would correctly load RGBA palette, and thus
> correctly preserve the semi-transparent information. I expected that
> the pil_saved.png file still looked the same as pil_rgba.png.
> == What actually happens? ==
> PIL throws away the Alpha channel, and the final pil_rgba.png image
> has all semi-transparent pixels converted to opaque.
> == Extra information ==
> The "feh" image viewer correctly supports RGBA palettes. Also, I think
> it is a better replacement for xv, for use in image.show()
> Both Firefox and Opera browsers correctly support RGBA palettes.
> Surprisingly, Gimp does not support RGBA palettes, and will convert
> semi-transparent colors to full transparency.
> == Similar messages ==
> While searching, I found these messages about the same subject:
> 25 Jan 2009 -
> 15 Nov 2008 -
> 27 Aug 2008 -
> 26 Jan 2005 -
> I'm not subscribed to this mail list, so please add me to CC when
> replying to this message.
Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
(121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)****
"In arithemtic as in politics, the importance of one is
determined by the number of zeros behind it." -- Anon
More information about the Image-SIG