14

I'm looking for something like PIL (Python Imaging Library), which sadly doesn't support WebP images.

I'd like to be able to do resizes and crops. Or at least convert to JPEG and then I can work it with PIL.

Francisco Passos
  • 310
  • 1
  • 3
  • 7

2 Answers2

8

Take a look at: http://code.google.com/p/python-webm/

I was able to walk through the test file to see how they were doing it.

xamox
  • 2,599
  • 4
  • 27
  • 30
  • 2
    I should note that now Pillow (https://pypi.python.org/pypi/Pillow/), fork of PIL supports webp out of the box. – xamox Nov 07 '13 at 15:47
  • The link no longer works. Please add an explanation that works, even if the link doesn't. – Marcin May 26 '22 at 07:09
4

imagemagick's convert tool, version 6.5.7-8 or better, can manipulate WebP images.

Also, Google provides an encoder and decoder for Linux, Windows and Mac OS X.

unutbu
  • 842,883
  • 184
  • 1,785
  • 1,677
  • 2
    Thanks for the tip unutbu. In this specific situation I have the pictures in memory and would prefer not to materialize them into files to call imagemagick's tools. If I were coding in C++ I might be able to hook directly into imagemagick's code though. The decoder provides an API at least, still C++, but in the end I can try to wrap it. – Francisco Passos Aug 01 '11 at 11:05
  • 1
    As a matter of fact, version 6.6.8-5 is the first to support WebP images (http://www.imagemagick.org/script/changelog.php) – Oct Jun 29 '12 at 14:39