diff --git a/PIL/PngImagePlugin.py b/PIL/PngImagePlugin.py index 5e5eb14c7..e329a6c0d 100644 --- a/PIL/PngImagePlugin.py +++ b/PIL/PngImagePlugin.py @@ -113,7 +113,8 @@ class ChunkStream(object): length = i32(s) if not is_cid(cid): - raise SyntaxError("broken PNG file (chunk %s)" % repr(cid)) + if not ImageFile.LOAD_TRUNCATED_IMAGES: + raise SyntaxError("broken PNG file (chunk %s)" % repr(cid)) return cid, pos, length