summaryrefslogtreecommitdiff
path: root/addons/web/models
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2020-10-15 12:44:38 +0000
committerXavier Morel <xmo@odoo.com>2020-10-15 15:25:47 +0000
commit1b20c67915e200f34fb975c73b0a5ff6b1d50e58 (patch)
treedebb982f8175223ba0a80507ed6cc5593ce6aedf /addons/web/models
parentbe1b2d4f4c6bd7c78cbc51e7fadeac51f38e9194 (diff)
[FIX] base: explicitly specify resampling filter when resizing
Pillow 7.0 changed the default resampling filter from NEAREST to BICUBIC. Because the logo parser resizes the image before sampling it and doesn't specify a filter, its behavior changes depending on the version of Pillow, even if the input image is the same. And there's a test depending on its output with a fixed image. Explicitly specify the old default as that's what's in the test. closes odoo/odoo#60117 X-original-commit: 3dbc0711b65ae47a230bcd8b3348962127bcaf14 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Diffstat (limited to 'addons/web/models')
-rw-r--r--addons/web/models/base_document_layout.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/web/models/base_document_layout.py b/addons/web/models/base_document_layout.py
index 6dd2883f3b9..3396e0db805 100644
--- a/addons/web/models/base_document_layout.py
+++ b/addons/web/models/base_document_layout.py
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
+from PIL import Image
from odoo import api, fields, models, tools
@@ -181,7 +182,7 @@ class BaseDocumentLayout(models.TransientModel):
# Converts to RGBA (if already RGBA, this is a noop)
image_converted = image.convert('RGBA')
- image_resized = image_converted.resize((w, h))
+ image_resized = image_converted.resize((w, h), resample=Image.NEAREST)
colors = []
for color in image_resized.getcolors(w * h):