-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
BugAny unexpected behavior, until confirmed feature.Any unexpected behavior, until confirmed feature.
Description
After update PIL to 5.4.0 I cannot load an image

image duplicate on Google drive
The example code shown bellow raises EOFError. But it worked correctly in previous versions.
The error was reproduced in Ubuntu 14.04 + Python 3.6.7 and macOS Sierra 10.12.6 + Python 3.6.3. In both cases Pillow 5.4.0 was uses. it seems the error was caused by the commit 22837c37e279a5fb3fb7b482d81e2c4d44c8cdcc.
from io import BytesIO
from PIL import Image
with open('mastercard.png', mode='rb') as fp:
im_bytes = fp.read()
image = Image.open(BytesIO(im_bytes))
image.show()Error log:
EOFError Traceback (most recent call last)
<ipython-input-11-d946298b95dd> in <module>
----> 1 image.show()
~/py/ocean/ocean_ai/env/lib/python3.6/site-packages/PIL/Image.py in show(self, title, command)
2039 """
2040
-> 2041 _show(self, title=title, command=command)
2042
2043 def split(self):
~/py/ocean/ocean_ai/env/lib/python3.6/site-packages/PIL/Image.py in _show(image, **options)
2904 def _show(image, **options):
2905 # override me, as necessary
-> 2906 _showxv(image, **options)
2907
2908
~/py/ocean/ocean_ai/env/lib/python3.6/site-packages/PIL/Image.py in _showxv(image, title, **options)
2909 def _showxv(image, title=None, **options):
2910 from . import ImageShow
-> 2911 ImageShow.show(image, title, **options)
2912
2913
~/py/ocean/ocean_ai/env/lib/python3.6/site-packages/PIL/ImageShow.py in show(image, title, **options)
51 """
52 for viewer in _viewers:
---> 53 if viewer.show(image, title=title, **options):
54 return 1
55 return 0
~/py/ocean/ocean_ai/env/lib/python3.6/site-packages/PIL/ImageShow.py in show(self, image, **options)
75 image = image.convert(base)
76
---> 77 return self.show_image(image, **options)
78
79 # hook methods
~/py/ocean/ocean_ai/env/lib/python3.6/site-packages/PIL/ImageShow.py in show_image(self, image, **options)
95 def show_image(self, image, **options):
96 """Display given image"""
---> 97 return self.show_file(self.save_image(image), **options)
98
99 def show_file(self, file, **options):
~/py/ocean/ocean_ai/env/lib/python3.6/site-packages/PIL/ImageShow.py in save_image(self, image)
91 def save_image(self, image):
92 """Save to temporary file, and return filename"""
---> 93 return image._dump(format=self.get_format(image), **self.options)
94
95 def show_image(self, image, **options):
~/py/ocean/ocean_ai/env/lib/python3.6/site-packages/PIL/Image.py in _dump(self, file, format, **options)
646 filename = filename + suffix
647
--> 648 self.load()
649
650 if not format or format == "PPM":
~/py/ocean/ocean_ai/env/lib/python3.6/site-packages/PIL/ImageFile.py in load(self)
248 self.readonly = readonly
249
--> 250 self.load_end()
251
252 if self._exclusive_fp and self._close_exclusive_fp_after_loading:
~/py/ocean/ocean_ai/env/lib/python3.6/site-packages/PIL/PngImagePlugin.py in load_end(self)
675
676 try:
--> 677 self.png.call(cid, pos, length)
678 except UnicodeDecodeError:
679 break
~/py/ocean/ocean_ai/env/lib/python3.6/site-packages/PIL/PngImagePlugin.py in call(self, cid, pos, length)
138
139 logger.debug("STREAM %r %s %s", cid, pos, length)
--> 140 return getattr(self, "chunk_" + cid.decode('ascii'))(pos, length)
141
142 def crc(self, cid, data):
~/py/ocean/ocean_ai/env/lib/python3.6/site-packages/PIL/PngImagePlugin.py in chunk_IDAT(self, pos, length)
354 self.im_tile = [("zip", (0, 0)+self.im_size, pos, self.im_rawmode)]
355 self.im_idat = length
--> 356 raise EOFError
357
358 def chunk_IEND(self, pos, length):
EOFError:
SergiiZaitsev, lshostenko, cgohlke, learning-lemon, mateuszbuda and 4 moreAlex-Bogdanov
Metadata
Metadata
Assignees
Labels
BugAny unexpected behavior, until confirmed feature.Any unexpected behavior, until confirmed feature.