def crc(self, cid, data): """Read and verify checksum""" # Skip CRC checks for ancillary chunks if allowed to load truncated # images # 5th byte of first char is 1 [specs, section 5.4] if ImageFile.LOAD_TRUNCATED_IMAGES and (PngImagePlugin.i8(cid[0]) >> 5 & 1): self.crc_skip(cid, data) return try: crc1 = PngImagePlugin._crc32(data, PngImagePlugin._crc32(cid)) crc2 = PngImagePlugin.i32(self.fp.read(4)) #if crc1 != crc2: # raise SyntaxError("broken PNG file (bad header checksum in %r)" # % cid) except struct.error: raise SyntaxError("broken PNG file (incomplete checksum in %r)" % cid)