mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Thumbnail: Fix CMYK images
This commit is contained in:
@@ -58,6 +58,8 @@ def create_thumbnail(sourcename, size):
|
|||||||
checksum = hashlib.md5(image.tobytes()).hexdigest()
|
checksum = hashlib.md5(image.tobytes()).hexdigest()
|
||||||
name = checksum + '.' + size.replace('^', 'c') + '.png'
|
name = checksum + '.' + size.replace('^', 'c') + '.png'
|
||||||
buffer = BytesIO()
|
buffer = BytesIO()
|
||||||
|
if image.mode not in ("1", "L", "RGB"):
|
||||||
|
image = image.convert('RGB')
|
||||||
image.save(fp=buffer, format='PNG')
|
image.save(fp=buffer, format='PNG')
|
||||||
imgfile = ContentFile(buffer.getvalue())
|
imgfile = ContentFile(buffer.getvalue())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user