[Image-SIG] How to compress Gif files with the GifImagePlugin

HSE, Graf Patrick pg@hse.ch
Tue, 6 Oct 1998 09:14:44 +0200

I'm using Python to upload image files to an Internet server.
This upload script does also some modification to the image (resize
with thumbnail function of the Image library).
This all works fine,  but surprise, surprise if I upload a GIF image
the file increases the file size from 16k to 42k!!!

After some mailing with Frederik Ludth I was told, that the files are
saved uncompressed in Python.(License problems for this LWZ compressing
routine). But there is a possibility with the GifImagePlugin to compress the 
Gif files.
Can anyone help me with this. I tried to use the GifImagePlugin and I also 
the "register_save..:" entry at the bottom of the GifImagePlugin.py file as 

Then I opened my image file and tried to save it with another filename. I got 
an error
that the file is in use by another process.

What am I doing wrong? I only want to save the Gif image file compressed as it 

Thanks for any help

Patrick Graf

Example script:

>>> import Image
>>> import GifImagePlugin
>>> im=Image.open("c:\\temp4\\nv01.gif")
>>> im.save("c:\\temp4\\nv02.gif")                                  # does this 
save the file compressed ?
The process can not access the file becaus it's in use by another process.