[Image-SIG] Fixes to PIL for handling XPM files.

Fredrik Lundh fredrik at pythonware.com
Thu Oct 26 10:23:39 CEST 2006


Tom Heathcote wrote:

> Attached is a diff file containing the changes I had to make to the
 > code to fix these problems.  This fixes things for the vast majority
 > of the XPM files I have.

thanks.  no time to comment on all these right now, but I couldn't help 
noticing the following:

> *Fix:* Changed _save() in GifImagePlugin.py.   The code was looking in 
> the wrong dictionary for the transparency value.

> *Fix:* Changed _save() in PngImagePlugin.py.  The code was looking in 
> the wrong dictionary for the transparency value.

the "info" dictionary is a free-form dictionary used to return in- 
formation from plugin loaders.  its content is not standardized,
is dropped by most image operations, and is therefore not used by "save".

instead, you have to use an explicit option when saving an image:

     im.save(filename, transparency=value)

(that you had to change all plugins should have told you that maybe you 
weren't using the API in the intended way, don't you think? ;-)

cheers /F



More information about the Image-SIG mailing list