:py:mod:`gnome.utilities.images2gif` ==================================== .. py:module:: gnome.utilities.images2gif .. autoapi-nested-parse:: MODULE images2gif Provides a function (writeGif) to write animated gif from a series of PIL images or numpy arrays. Added as a handy utility to the py_gnoe code. Adapted form code from: Almar Klein (June 2009) - based on gifmaker (in the scripts folder of the source distribution of PIL) - based on gif file structure as provided by wikipedia This code is provided as is, and is free to use for all. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: gnome.utilities.images2gif.intToBin gnome.utilities.images2gif.getheaderAnim gnome.utilities.images2gif.getAppExt gnome.utilities.images2gif.getGraphicsControlExt gnome.utilities.images2gif._writeGifToFile gnome.utilities.images2gif.writeGif Attributes ~~~~~~~~~~ .. autoapisummary:: gnome.utilities.images2gif.PIL gnome.utilities.images2gif.np gnome.utilities.images2gif.im .. py:data:: PIL .. py:data:: np .. py:function:: intToBin(i) Integer to two bytes .. py:function:: getheaderAnim(im) Animation header. To replace the getheader()[0] .. py:function:: getAppExt(loops=0) Application extention. Part that secifies amount of loops. if loops is 0, if goes on infinitely. .. py:function:: getGraphicsControlExt(duration=0.1) Graphics Control Extension. A sort of header at the start of each image. Specifies transparancy and duration. .. py:function:: _writeGifToFile(fp, images, durations, loops) Given a set of images writes the bytes to the specified stream. .. py:function:: writeGif(filename, images, duration=0.1, loops=0, dither=1) writeGif(filename, images, duration=0.1, loops=0, dither=1) Write an animated gif from the specified images. images should be a list of numpy arrays of PIL images. Numpy images of type float should have pixels between 0 and 1. Numpy images of other types are expected to have values between 0 and 255. .. py:data:: im