[Image-SIG] Saving gifs with transparency
Will Stephenson
lists at stevello.free-online.co.uk
Mon Feb 16 10:00:35 EST 2004
On Monday 16 February 2004 12:34, Will Stephenson wrote:
> Even if I just load the gif and save it again without drawing on it,
> transparency is lost. I'm checking the result using Gimp and KDE image
> viewers as I see XV doesn't support transparency.
The plot thickens. I had a look at GifImagePlugin, and noticed there was an
option to use an external module to save the gif and a check to see if there
is a key 'transparency' in the im.encoderinfo dictionary, so I added some
debug prints to see what was going on there.
There is no external module in use, but neither is the transparency key
present, and opening the newly written file reveals PIL itself thinks the
newly written file has become GIF87a from GIF89a, with no transparency:
· im = Image.open( imageFile )
· print im.info.has_key('transparency')
· print im.info
· im.info['transparency'] = im.info['background']
· im.save(imageFileCopy, 'GIF')
· im2 = Image.open( imageFileCopy )
· print im2.info
./text3.py
True
{'duration': 100, 'version': 'GIF89a', 'transparency': 254, 'background': 255}
Using internal driver
no transparency present
{'version': 'GIF87a', 'background': 0}
Will
--
Will Stephenson
IRC: Bille
More information about the Image-SIG
mailing list