[Image-SIG] Re: How to tell whether/what is the alpha color in an
indexed image file ?
Fredrik Lundh
fredrik at pythonware.com
Fri Mar 25 08:27:06 CET 2005
Ray Pasco wrote:
> If a PNG image with an alpha layer is opened, the im.mode will be "RGBA".
> However, if an indexed PNG or GIF is opened with an alpha color set,
> the mode is simply "P" (no "A" as in "PA").
>
> 1) How can I get PIL to tell me if and what is the "alpha" color index ?
crop out the interesting pixel(s) and convert to RGBA, and use
getpixel on the resulting image.
> 2) When an RGBA image is converted to an indexed image, does PIL record
> the occurance in some manner that any pixels had alpha values set to less than 255 ?
RGBA->P is equivalent to RGBA->RGB->P, so the answer is no.
</F>
More information about the Image-SIG
mailing list