[Image-SIG] Png24 to GIF image size

Tom Blackmore tablackmore at gmail.com
Fri May 20 11:00:46 CEST 2011


Hi All,

I'm having problems converting a png24 to a gif image. The conversion works,
it's just the gif file is very large.

The example C00000004.png is 14k. When I convert it to a gif with pil the
file is 17k (test_pil.gif). If I use a Java library the gif is only 7k (
test_java.gif). I've got about 10000000 images to process so this is quite a
big deal.

I've enclosed an example of a png that I'm trying to convert C00000004.png
and the result from my conversion with PIL (test_pil.gif) and the result
from Java conversion test_java.pil.

The Python code I'm using:

im = Image.open(path + 'C00000004.png')
im = im.convert('RGB').convert('P', palette=Image.ADAPTIVE)
im.save(path + 'test.gif','gif')

In the Java version I'm using ImageIO like this.

ImageIO.write(img, "gif", outputfile);

 Am I missing something?

Thanks in advance for any help.

Kind regards

Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20110520/48954347/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: C00000004.png
Type: image/png
Size: 13580 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20110520/48954347/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_java.gif
Type: image/gif
Size: 6431 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20110520/48954347/attachment-0002.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_pil.gif
Type: image/gif
Size: 16556 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20110520/48954347/attachment-0003.gif>


More information about the Image-SIG mailing list