pyguymer3.image.image2gif¶
- pyguymer3.image.image2gif(img, gif, /, *, chunksize=1048576, debug=True, exiftoolPath=None, gifsiclePath=None, jpegtranPath=None, mode='RGB', optimise=True, optipngPath=None, screenHeight=-1, screenWidth=-1, strip=False, timeout=60.0)[source]¶
Save an image as a GIF
This function accepts either a PIL Image or a file path and saves the image as a GIF.
- Parameters:
img (PIL.Image.Image or str) – the input PIL Image or path to the input image
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)
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 image to fit within, currently only implemented if “img” is a str (default -1; integers less than 100 imply no downscaling)
screenWidth (int, optional) – the width of the screen to downscale the input image to fit within, currently only implemented if “img” is a 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