Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >>> import struct
- >>> fmt = '<3s3sHH' # 1
- >>> with open('filter.gif', 'rb') as fp:
- ... img = memoryview(fp.read()) # 2
- ...
- >>> header = img[:10] # 3
- >>> bytes(header) # 4
- b'GIF89a+\x02\xe6\x00'
- >>> struct.unpack(fmt, header) # 5
- (b'GIF', b'89a', 555, 230)
- >>> del header # 6
- >>> del img
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement