4

I already tried this:

from PIL import Image
im = Image.open('this.webp')
im.save('that.gif', 'gif', save_all=True)

which is giving me this error

TypeError: unsupported operand type(s) for &: 'tuple' and 'int'

I have hundreds of webp images on my site and need to convert them to gif, because Firefox doesn't support it. Thank you.

nick
  • 1,090
  • 1
  • 11
  • 24
Azimjon Pulatov
  • 101
  • 2
  • 7

1 Answers1

7

Set background to None before saving.

from PIL import Image
im = Image.open('this.webp')
im.info.pop('background', None)
im.save('that.gif', 'gif', save_all=True)

Thanks to: https://github.com/python-pillow/Pillow/issues/2949#issuecomment-419422861

Community
  • 1
  • 1
muratgozel
  • 2,333
  • 27
  • 31