[Image-SIG] New to PIL and struggling...
Fredrik Lundh
fredrik at pythonware.com
Fri May 6 12:19:32 CEST 2005
"charlie clark" wrote:
> Trying to understand things: lut is effectively a palette table all set to
> the same value?
> What does lut[im.info["transparency"]] = 0 do?
> In my case its would sets lut[14] = 0
> So the real magic is im.point() which creates a single band presumably
> reacting to the transparency in the original image.
"point" just maps the source pixels through the lookup-table
(the "lut"), like this:
for all coordinates in image:
... load pixel from input image ...
pixel = lut[pixel]
... store pixel in output pixel ...
the result is a mask which has the value 0 for all transparent pixels
(index 14), and the value 1 for all other pixels. "point" itself doesn't
know about transparency; it just uses the table it got.
</F>
More information about the Image-SIG
mailing list