1

I am using the bird animated gif from this stackoverflow question about resizing gifs. The image size on disk is about 2.1MB. Now if I do (using python3.5)

import PIL.Image
PIL.Image.open('bird.gif').save('output.gif', save_all=True, optimize=True)

I obtain an image of size 7.5MB.

Using imageio, I am not getting any luckier:

import imageio
im = imageio.mimread('bird.gif')
imageio.mimsave('output.gif', im)

I obtain the exact same size of gif.

Does anyone know how to save an animated gif so that it remains as small as possible, which means at least as small as the input gif ?

Thanks!

  • The best way is to use a tool that's purpose-built to reduce image size, not a general purpose image package. – Mark Ransom Jan 16 '18 at 17:38
  • Thanks Mark! following that path, I figured that [Gifsicle](https://www.lcdf.org/gifsicle/) is a good tool for that.I would have preferred a python library so as to do it programmatically instead of calling a subprocess from the python code, but at least I have a solution ! – Olivier Teboul Jan 17 '18 at 09:01

0 Answers0