From 5cbcbe6d7efad6050e29d74b998bd84c60da66e6 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Wed, 21 Mar 2018 09:55:38 +0100 Subject: [PATCH] Thumbnail: Fix CMYK images --- src/pretix/helpers/thumb.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pretix/helpers/thumb.py b/src/pretix/helpers/thumb.py index 66c9553a1a..40e7042f03 100644 --- a/src/pretix/helpers/thumb.py +++ b/src/pretix/helpers/thumb.py @@ -58,6 +58,8 @@ def create_thumbnail(sourcename, size): checksum = hashlib.md5(image.tobytes()).hexdigest() name = checksum + '.' + size.replace('^', 'c') + '.png' buffer = BytesIO() + if image.mode not in ("1", "L", "RGB"): + image = image.convert('RGB') image.save(fp=buffer, format='PNG') imgfile = ContentFile(buffer.getvalue())