diff --git a/PIL/WebPImagePlugin.py b/PIL/WebPImagePlugin.py index 628ac7ff6..9321c05f3 100644 --- a/PIL/WebPImagePlugin.py +++ b/PIL/WebPImagePlugin.py @@ -23,7 +23,7 @@ def _save(im, fp, filename): raise IOError("cannot write mode %s as WEBP" % im.mode) quality = im.encoderinfo.get("quality", 80) - data = _webp.WebPEncodeRGB(im.tostring(), im.size[0], im.size[1], im.size[0] * 3, float(quality)) + data = _webp.WebPEncodeRGB(im.tobytes(), im.size[0], im.size[1], im.size[0] * 3, float(quality)) fp.write(data) Image.register_open("WEBP", WebPImageFile, _accept)