0

I'm trying to convert a large amount of photos into the webp format. The lines of code I'm using are as simple as :

from PIL import Image

im = Image.open('./images/image_1.jpg')
im = im.convert('RGB')
im.save('./webps/image_1.webp', 'webp')

Unfortunately, I get the following error because of the last line :

C:\Anaconda\...\lib\site-packages\PIL\WebPImagePlugin.py in _save(im, fp, filename)
335         method,
336         exif,
--> 337         xmp,
338     )
339     if data is None:

TypeError: function takes exactly 9 arguments (10 given)

I have no idea on how to solve this error as it doen't make any sense to me.

TitoDev
  • 13
  • 5
  • 1
    https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html?highlight=file%20formats Pillow reads and writes WebP files. The specifics of Pillow’s capabilities with this format are currently undocumented. – pippo1980 Feb 18 '21 at 19:13
  • 1
    https://stackoverflow.com/questions/19860639/convert-images-to-webp-using-pillow Convert images to webP using Pillow see answer Make sure to install WEBP dev library for your OS. For Debian/Ubuntu it's libwebp-dev. You may need reinstall Pillow as well. In the output of Pillow install log you should see: --- WEBP support available – pippo1980 Feb 18 '21 at 19:18
  • 1
    https://stackoverflow.com/questions/55349110/webp-support-not-installed-error-with-pillow-included-in-anaconda – pippo1980 Feb 18 '21 at 19:25

0 Answers0