-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Problems with other data-types than uint8 #4887
Comments
Related to #1888. |
After going through some of the related issues I now see that @wiredfool commented on 12 Jan 2018 in #2955: In my opinion, it would be nice if there would at least be an error text that can explain this limitation of 8bpc. Also, this limitation could be made a lot more clear on the information pages. Since I did not know about this, it took me quite some time to fix the problem. |
I'll point out that an error is displayed - if you don't pass import numpy as np
from PIL import Image
array = np.full((32,32,3),255)
Image.fromarray(array)
|
I think the fact that an error isn't displayed can be considered part of #2856 |
Do you have any ideas where a good place for this documentation would be? https://pillow.readthedocs.io/en/stable/handbook/concepts.html#modes doesn't seem like the right place, since it is about the modes that Pillow uses to store image data, not about the modes used to read image data from files. |
I've created PR #6638 to resolve this by documenting the current limitation. |
What did you do?
I was trying to create an Image from a numpy array using Image.fromarray(array, mode) and validate the created image by using the show() function. It did not create the right image.
What did you expect to happen?
Show a white image
What actually happened?
Showed an image with seperated colors.
What are your OS, Python and Pillow versions?
What is the problem?
Pillow shows the right image if the dtype of the values in the array is uint8, but seems to have problems accepting other data types.
It does however work if I first convert the array to uint8:
The text was updated successfully, but these errors were encountered: