You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromPILimportImageimportio# assumes the current directory is the root of this repository.withopen('Tests/images/imagedraw_polygon_1px_high.png', 'rb') asf:
data=bytearray(f.read())
# insert the sRGB chunk after the IDAT chunk. Its length, chunk type and crc are valid, but the sRGB chunk should contain more data.data[61:61] =b"\x00\x00\x00\x00sRGB\x10\x1c\xd3\xce"# IndexError is raisedwithImage.open(io.BytesIO(data)) asimg:
img.load()
What did you expect to happen?
IndexError is a little conusing. Maybe ValueError is better.
What actually happened?
Traceback (most recent call last):
File "issue_index_error_simplified.py", line 14, in <module>
img.load()
File "/usr/local/lib/python3.8/dist-packages/PIL/ImageFile.py", line 268, in load
self.load_end()
File "/usr/local/lib/python3.8/dist-packages/PIL/PngImagePlugin.py", line 978, in load_end
self.png.call(cid, pos, length)
File "/usr/local/lib/python3.8/dist-packages/PIL/PngImagePlugin.py", line 202, in call
return getattr(self, "chunk_" + cid.decode("ascii"))(pos, length)
File "/usr/local/lib/python3.8/dist-packages/PIL/PngImagePlugin.py", line 512, in chunk_sRGB
self.im_info["srgb"] = s[0]
IndexError: index out of range
What are your OS, Python and Pillow versions?
OS: ubuntu:focal-20220426
Python: 3.8.10
Pillow: 9.2.0
The text was updated successfully, but these errors were encountered:
What did you do?
What did you expect to happen?
IndexError is a little conusing. Maybe ValueError is better.
What actually happened?
What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: