-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Image of size zero is not getting initialized #2259
Copy link
Copy link
Closed
Description
I want an image with zero size. I have a lot of use for it.
>>> from PIL import Image as im
>>> import numpy as np
>>> im.fromarray(np.empty((0, 0), dtype=np.uint8))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/PIL/Image.py", line 2187, in fromarray
return frombuffer(mode, size, obj, "raw", rawmode, 0, 1)
File "/usr/local/lib/python3.4/dist-packages/PIL/Image.py", line 2114, in frombuffer
_check_size(size)
File "/usr/local/lib/python3.4/dist-packages/PIL/Image.py", line 2001, in _check_size
raise ValueError("Width and Height must be > 0")
ValueError: Width and Height must be > 0This was working previously. But after this commit, in the latest version (i.e. 3.4.2) it is throwing an error.
As @manthey points out in the commit, one can create a zero sized image by cropping an existing one. So this too should be allowed.
Thanks.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels