Improved load truncated images

This commit is contained in:
David Schmidt 2013-01-11 14:40:02 +01:00
parent ee04c7ceea
commit 33bf5d9d37

View File

@ -226,9 +226,8 @@ class ImageFile(Image.Image):
self.fp = None # might be shared
if not LOAD_TRUNCATED_IMAGES and not self.map and e < 0:
# Note: If loading a truncated image results in an all black Image,
# the decoder wasn't able to decode anything.
if (t == 0 or not LOAD_TRUNCATED_IMAGES) and not self.map and e < 0:
# still raised if decoder fails to return anything
raise_ioerror(e)
# post processing