[IMP] image.py: Make 6801baa work in python3
This commit is contained in:
+1
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user