pyguymer3.media.images2gif

pyguymer3.media.images2gif(imgs, gif, /, *, chunksize=1048576, debug=True, exiftoolPath=None, fps=25.0, gifsiclePath=None, jpegtranPath=None, mode='RGB', optimise=True, optipngPath=None, screenHeight=-1, screenWidth=-1, strip=False, timeout=60.0)[source]

Convert a sequence of images to a GIF animation.

This function makes a GIF animation from either a list of PIL Images or a list of file paths. The user is able to set the framerate.

Parameters:
  • imgs (list of PIL.Image.Image or list of str) – the list of input PIL Images or list of paths to the input images

  • gif (str) – the path to the output GIF

  • chunksize (int, optional) – the size of the chunks of any files which are read in (in bytes)

  • debug (bool, optional) – print debug messages (default False)

  • exiftoolPath (str, optional) – the path to the “exiftool” binary (if not provided then Python will attempt to find the binary itself)

  • fps (float, optional) – the framerate, default 25.0

  • gifsiclePath (str, optional) – the path to the “gifsicle” binary (if not provided then Python will attempt to find the binary itself)

  • jpegtranPath (str, optional) – the path to the “jpegtran” binary (if not provided then Python will attempt to find the binary itself)

  • mode (str, optional) – the mode of the outout GIF (default “RGB”)

  • optimise (bool, optional) – optimise the output GIF (default True)

  • optipngPath (str, optional) – the path to the “optipng” binary (if not provided then Python will attempt to find the binary itself)

  • screenHeight (int, optional) – the height of the screen to downscale the input images to fit within, currently only implemented if “imgs” is a list of str (default -1; integers less than 100 imply no downscaling)

  • screenWidth (int, optional) – the width of the screen to downscale the input images to fit within, currently only implemented if “imgs” is a list of str (default -1; integers less than 100 imply no downscaling)

  • strip (bool, optional) – strip metadata from the output GIF (default False)

  • timeout (float, optional) – the timeout for any requests/subprocess calls

Notes

Copyright 2017 Thomas Guymer [1]

References