diff --git a/odoo/tools/image.py b/odoo/tools/image.py index 4341e11a571..0ec27ff445c 100644 --- a/odoo/tools/image.py +++ b/odoo/tools/image.py @@ -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