title: Convert images to webP using Pillow
body: <p>I'm trying to convert .jpg images to webp format using <a href="https://pypi.python.org/pypi/Pillow/">PIL</a>.</p>
  
  <p>I'm using the this code:</p>
  
  <pre><code>from PIL import Image
  import glob, os
  
  for infile in glob.glob("*.jpg"):
      file, ext = os.path.splitext(infile)
      im = Image.open(infile).convert("RGB")
      im.save(file + ".webp", "WEBP")
  </code></pre>
  
  <p>But I get the following error on running it:</p>
  
  <pre><code>Traceback (most recent call last):
    File "webp.py", line 7, in &lt;module&gt;
      im.save(file + ".webp", "WEBP")
    File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 1444, in save
      save_handler = SAVE[format.upper()] # unknown format
  KeyError: 'WEBP'
  </code></pre>
  
  <p>Kindly help me fixing it. I have installed <code>libwebp-dev</code>.</p>
  
  <pre><code>&gt;&gt;&gt; import PIL
  &gt;&gt;&gt; dir(PIL)
  ['PILLOW_VERSION', 'VERSION', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', '_plugins']
  &gt;&gt;&gt; PIL.PILLOW_VERSION
  '2.2.1'
  &gt;&gt;&gt; PIL.VERSION
  '1.1.7'
  </code></pre>