I was using pillow version 2.2.2 to convert webp image to jpeg image. The webp images are stored in a memory buffer. I found that when I try tom open the webp image it cause a memory leak with large number of images become a real problem.
def webp_to_jpeg(raw_img):
image = Image.open(StringIO.StringIO(raw_img))
buffer = StringIO.StringIO()
image.save(buffer, "JPEG")
return string_buffer.getvalue()
This memory leak only happen when I work with webp images. I try to update pillow to 2.3.0 however when I did that I was not able to read webp images at all and I got the following exception "WEBP unknown extension"