mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 12:13:49 +01:00
Fix saving of non-RGB thumbnails as PNG (#17736)
This commit is contained in:
parent
b1b4b2944d
commit
60aebdb27e
2 changed files with 2 additions and 1 deletions
1
changelog.d/17736.bugfix
Normal file
1
changelog.d/17736.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix saving of PNG thumbnails, when the original image is in the CMYK color space.
|
|
@ -206,7 +206,7 @@ class Thumbnailer:
|
||||||
def _encode_image(self, output_image: Image.Image, output_type: str) -> BytesIO:
|
def _encode_image(self, output_image: Image.Image, output_type: str) -> BytesIO:
|
||||||
output_bytes_io = BytesIO()
|
output_bytes_io = BytesIO()
|
||||||
fmt = self.FORMATS[output_type]
|
fmt = self.FORMATS[output_type]
|
||||||
if fmt == "JPEG":
|
if fmt == "JPEG" or fmt == "PNG" and output_image.mode == "CMYK":
|
||||||
output_image = output_image.convert("RGB")
|
output_image = output_image.convert("RGB")
|
||||||
output_image.save(output_bytes_io, fmt, quality=80)
|
output_image.save(output_bytes_io, fmt, quality=80)
|
||||||
return output_bytes_io
|
return output_bytes_io
|
||||||
|
|
Loading…
Reference in a new issue