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
BUG: avoid AttributeError when setting mode in Pillow v10.1 #1045
Conversation
Looks like there is not just a problem with I'll have to set some time aside to figure out where/why this breaks. |
@FirefoxMetzger thanks for the quick reaction and working on this! |
@lagru I've merged a pin for |
No worries. We've applied the same temporary fix to scikit-image and are in no particular hurry. Please don't feel rushed. :) |
(which appears to now be supported. TODO: xref pillow's source)
Looks like I finally managed to solve all the CI issues. Now it's only test coverage left. I also want to check why we can now use "rawmodes" like "I;16" in |
For future reference: Recent pillow versions no longer allow direct decoding of 16-bit grayscale PNGs. While we instruct Pillow to do so using the (now available) mode I will create a ticket over at pillow and see if we can bring the old functionality back - perhaps in a different way - since it is quite useful and I would eventually like to use it in other places as well. |
Closes: #1044
Pillow v10.1 removed the setter for
Image.mode
as this can have unintended consequences. This is done by makingImage.mode
a@property
and keeping the mode inImage._mode
.While okay in general, it breaks our setup as there is currently no good way of setting 16-bit return types directly (which we want when reading 16-bit grayscale PNGs). As a result, this change breaks our current setup.
This PR introduces a "quick fix" by directly setting
Image._mode
instead of the previousImage.mode
. I'm not fond of this solution, but until something better becomes available this is the only way I can think of to maintain our current behavior.