pyguymer3.image.image2webp

pyguymer3.image.image2webp(img, webp, /, *, exif=None, lossless=False, method=6, mode='RGB', quality=100, screenHeight=-1, screenWidth=-1)[source]

Save an image as a WEBP

This function accepts either a PIL Image or a file path and saves the image as a WEBP.

Parameters:
  • img (PIL.Image.Image or str) – the input PIL Image or path to the input image

  • webp (str) – the path to the output WEBP

  • exif (dict, optional) – a dictionary of EXIF data to save in the output WEBP (default None)

  • lossless (bool, optional) – save a lossless WEBP (default False)

  • method (int, optional) – the method to use when saving the WEBP (default 6)

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

  • quality (int, optional) – the quality of the output WEBP (default 100)

  • 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)

Notes

Copyright 2017 Thomas Guymer [1]

References