PIL and transparent GIFs

Fredrik Lundh fredrik at pythonware.com
Thu Feb 2 02:12:46 EST 2006


Terry Hancock wrote:

> There was a patch published at one time that was supposed
> to fix this. I remember doing some testing and not finding
> it to work perfectly, but I may have been doing something
> wrong.  Can't recover it at the moment, but some search
> engine work might turn it up.

transparency write support was added in 2002.

however, PIL's Image object doesn't have a notion of "transparent
color index", so you have to keep track of it yourself.

    im = Image.open(...)
    transparency = im.info["transparency"]
    ...
    out.save("out.gif", transparency=transparency)

</F>






More information about the Python-list mailing list