-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Description
What did you do?
Create a size (0,0) image instead of None, for convenient in coding,
x.width
x.height
# other stuffs
x.tobytes()to get rid of
if x:
x.width
x.height
# other stuffs
x.tobytes()What did you expect to happen?
Normal, probably return b''
What actually happened?
---------------------------------------------------------------------------
SystemError Traceback (most recent call last)
<ipython-input-0-d240cdef7328> in <module>
----> 1 Image.new("RGB",(0,0)).tobytes()
c:\program files\python38\lib\site-packages\PIL\Image.py in tobytes(self, encoder_name, *args)
720 # unpack data
721 e = _getencoder(self.mode, encoder_name, args)
--> 722 e.setimage(self.im)
723
724 bufsize = max(65536, self.size[0] * 4) # see RawEncode.c
SystemError: tile cannot extend outside imageWhat are your OS, Python and Pillow versions?
- OS: Win10 1803
- Python: 3.8.10
- Pillow: 9.0.0
from PIL import Image
Image.new("RGB",(0,0)).tobytes()Metadata
Metadata
Assignees
Labels
No labels