images2gif module

Module images2gif

Provides functionality for reading and writing animated GIF images. Use writeGif to write a series of numpy arrays or PIL images as an animated GIF. Use readGif to read an animated gif as a series of numpy arrays.

Note that since July 2004, all patents on the LZW compression patent have expired. Therefore the GIF format may now be used freely.

Acknowledgements

Many thanks to Ant1 for: * noting the use of “palette=PIL.Image.ADAPTIVE”, which significantly

improves the results.
  • the modifications to save each image with its own palette, or optionally the global palette (if its the same).

Many thanks to Marius van Voorden for porting the NeuQuant quantization algorithm of Anthony Dekker to Python (See the NeuQuant class for its license).

Many thanks to Alex Robinson for implementing the concept of subrectangles, which (depening on image content) can give a very significant reduction in file size.

This code is based on gifmaker (in the scripts folder of the source distribution of PIL)