Replies: 2 comments 4 replies
-
I'm not able to replicate this. With 11.3.0, I receive Traceback (most recent call last):
File "demo.py", line 6, in <module>
img = Image.fromarray(data, mode="rgb")
File "PIL/Image.py", line 3336, in fromarray
return frombuffer(mode, size, obj, "raw", rawmode, 0, 1)
File "PIL/Image.py", line 3225, in frombuffer
return frombytes(mode, size, data, decoder_name, args)
File "PIL/Image.py", line 3152, in frombytes
im = new(mode, size)
File "PIL/Image.py", line 3117, in new
return im._new(core.fill(mode, size, color))
ValueError: unrecognized image modeBut I do receive a different error with Pillow 12. Traceback (most recent call last):
File "PIL/Image.py", line 3285, in fromarray
typemode, rawmode, color_modes = _fromarray_typemap[typekey]
KeyError: ((1, 1, 3), '<f8')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "demo.py", line 6, in <module>
img = Image.fromarray(data, mode="rgb")
File "PIL/Image.py", line 3289, in fromarray
raise TypeError(msg) from e
TypeError: Cannot handle this data type: (1, 1, 3), <f8 |
Beta Was this translation helpful? Give feedback.
-
|
Thanks. Previously, the You have seen that there is a deprecation for some So there should be two scenarios that currently work, but are deprecated.
Unintentionally, during that rollback, I dropped support for the first scenario. It should be deprecated, but still work, but now it just doesn't work. Now that it is out there though, I'm not convinced that we should bring back the deprecation? It seems odd to make Pillow 12.1.0 work, only to take the fuctionality away again when the deprecation ends in Pillow 13 in October 2026. Feel free to offer your thoughts. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm updating some old code and noticed a new failure that I'm really surprised ever worked in the first place.
With older pre-12.0 versions of PIL this magically worked. If you look at the properties,
data.dtypeis actually 64-bit float andnp.array(img).dtypewill give youuint8. In newer PIL this fails due to no cases infromarray's type map for float -> RGB. This totally makes sense, it isn't a usual common case or even what my original code was intended to do. I think my original code assumeddatawould always be integers. However, after looking in the pillow code I can't find a reason for this to have worked.Beta Was this translation helpful? Give feedback.
All reactions