Created
August 4, 2018 04:21
-
-
Save GiantRobato/5fd2513b73830584d6078c0fe9341c87 to your computer and use it in GitHub Desktop.
reads through all the chunks of a png file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while True: | |
chunk = f.read(4) | |
if not chunk: break | |
chunkType = f.read(4) | |
numBytes = int.from_bytes(chunk, byteorder='big') | |
data = f.read(numBytes) | |
crc = f.read(4) | |
print(chunkType) | |
print(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment