From efd5b5b1daa42f96e4a92afecd0b26f04f605005 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 26 Jul 2021 17:08:26 +0200 Subject: [PATCH] Thumbnailer: Do not screw with image modes --- src/pretix/helpers/thumb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pretix/helpers/thumb.py b/src/pretix/helpers/thumb.py index a660e74b9..05e56554e 100644 --- a/src/pretix/helpers/thumb.py +++ b/src/pretix/helpers/thumb.py @@ -149,7 +149,8 @@ def resize_image(image, size): if min_width > new_size[0] or min_height > new_size[1]: padding = math.ceil(max(min_width - new_size[0], min_height - new_size[1]) / 2) - image = image.convert('RGB') + if image.mode not in ("RGB", "RGBA"): + image = image.convert('RGB') image = ImageOps.expand(image, border=padding, fill="white") new_width = max(min_width, new_size[0])