[IMP] image.py: Make 6801baa work in python3

This commit is contained in:
Yannick Tivisse
2017-09-05 16:31:47 +02:00
parent 46699c5214
commit f49683bc0f
+1 -3
View File
@@ -199,11 +199,9 @@ def crop_image(data, type='top', ratio=False, size=None, image_format="PNG"):
raise ValueError('ERROR: invalid value for crop_type')
if size:
thumbnail = Image.open(io.BytesIO(output_stream.getvalue()))
output_stream.truncate(0)
output_stream.seek(0) # for python 3
thumbnail.thumbnail(size, Image.ANTIALIAS)
thumbnail.save(output_stream, image_format)
return output_stream.getvalue().encode('base64')
return base64.b64encode(output_stream.getvalue())
# ----------------------------------------
# Colors