[FIX] resize_image: auto convert BMP images to PNG

bzr revid: chs@openerp.com-20140401154417-c8buuqybdsihn3om
This commit is contained in:
Christophe Simonis 2014-04-01 17:44:17 +02:00
parent c65ae9f055
commit 11af46b2b1
1 changed files with 5 additions and 1 deletions

View File

@ -70,7 +70,11 @@ def image_resize_image(base64_source, size=(1024, 1024), encoding='base64', file
image_stream = StringIO.StringIO(base64_source.decode(encoding))
image = Image.open(image_stream)
# store filetype here, as Image.new below will lose image.format
filetype = filetype or image.format
filetype = (filetype or image.format).upper()
filetype = {
'BMP': 'PNG',
}.get(filetype, filetype)
asked_width, asked_height = size
if asked_width is None: