PIL and transparent GIFs

toto toto at titi.de
Wed Feb 1 16:29:46 EST 2006


Hi,

Does anybody know how to save an image in GIF format preserving transparent
background ??

Here's what I tested :

import Image, ImageDraw
im = Image.open('/path/to/model.gif') # An image with transparent backgroung
draw = ImageDraw.Draw(im)
draw.polygon([153,106,186,225,340,193,315,81,304,167], fill=9587)
im.save('/path/to/model1.gif', 'GIF')

And model1.gif has no transparent background anymore even if it's bigger
than my polygon selection.

Regards,

Laurent.



More information about the Python-list mailing list