From fd4b83e8d14e841d37622ddb0be811aa07bd2562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 13 Sep 2012 13:36:55 +0200 Subject: [PATCH] [FIX] tools.image: added an image conversion before sharpening; otherwise the filter could crash. bzr revid: tde@openerp.com-20120913113655-t5o3wk3r0tkp203m --- openerp/tools/image.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openerp/tools/image.py b/openerp/tools/image.py index f673906f328..38997978326 100644 --- a/openerp/tools/image.py +++ b/openerp/tools/image.py @@ -66,8 +66,9 @@ def image_resize_image(base64_source, size=(1024, 1024), encoding='base64', file # check image size: do not create a thumbnail if avoiding smaller images if avoid_if_small and image.size[0] <= size[0] and image.size[1] <= size[1]: return base64_source - # create a thumbnail: will resize and keep ratios + # create a thumbnail: will resize and keep ratios, then sharpen for better looking result image.thumbnail(size, Image.ANTIALIAS) + image.convert('RGB') image = image.filter(ImageFilter.SHARPEN) # create a transparent image for background background = Image.new('RGBA', size, (255, 255, 255, 0))