-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Unclear error when displaying images from arrays of float dtype in notebook #5116
Comments
For B, you're asking for specific error messages for IPython, which I don't think can be neatly added in while keeping the other uses of Pillow in mind - in any other situation, the user might see this error message and just pick a format other than PNG. #5139 is the best I personally have to offer, adding an error explaining that Pillow was trying to saving to PNG for display. |
Thanks :) |
Be aware that #7266 is now proposing an alternative to this - capturing any errors and returning |
Floating point images from numpy arrays via the
PIL.Image.fromarray()
raise an unclear error when accidentally returned in jupyter notebook as the final line in a cell. This triggersIPython.display.display()
on the image object, which in turn calls the image object_repr_png_()
method, which raises the error below.What did you do?
Called
What did you expect to happen?
Either:
A) Attempt to show the image given some defaults (like showing the image on a 8bit depth (resulting in a black image or very dark image)
B) More likely: Raise a clear error saying that you can't create images out of floating point values, and should instead (probably rescale to an appropriate bitdepth range and) change the dtype to be
uint8
or some other accepted dtype.What actually happened?
I get an error about how one cannot write mode F as png:
What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: