-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix saving of non-RGB thumbnails as PNG #17736
Conversation
The PNG format does not support non-RGB color spaces, which makes pillow raise an exception when trying to save e.g. a CMYK image in PNG format. Converting to RGB is recommended on the upstream issue, and as CMYK is a print format transparency does not need to be considered. Closes: element-hq#10741
1a9825e
to
81c7978
Compare
Thanks for the fix @mweinelt. I've attempted to write a test for this in #17786, but aren't actually seeing the test fail on Are you seeing this issue on your personal deployment? If so, what Pillow version are you using, and do you have a test image I could try? |
I was writing some for to fix something similar and I suspect it only fails under dynamic thumbnails or something like that? Ie by default jpeg gets thumbailed as jpeg? There might be other configuration aspects too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Despite not being able to reproduce this, the change doesn't appear to have any downsides as indeed CMYK does not have an alpha channel. I'd say we just merge it and see if this breaks anyone's workflow.
I do not have a test image. Multiple times per day I spotted the same traceback as the author of the issue. I am not sure what images have been causing this. Yes, private deployment on NixOS 24.05 with pillow 10.3.0. |
Thanks for confirming the details! Please open a new issue if you see the problem reoccur after this change. It should go out in Synapse v1.118.0. |
The PNG format does not support non-RGB color spaces, which makes pillow raise an exception when trying to save e.g. a CMYK image in PNG format.
Converting to RGB is recommended on the upstream issue, and as CMYK is a print format transparency does not need to be considered.
Closes: #10741
Pull Request Checklist
EventStore
toEventWorkerStore
.".code blocks
.(run the linters)