Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. >>> import struct
  2. >>> fmt = '<3s3sHH' # 1
  3. >>> with open('filter.gif', 'rb') as fp:
  4. ... img = memoryview(fp.read()) # 2
  5. ...
  6. >>> header = img[:10] # 3
  7. >>> bytes(header) # 4
  8. b'GIF89a+\x02\xe6\x00'
  9. >>> struct.unpack(fmt, header) # 5
  10. (b'GIF', b'89a', 555, 230)
  11. >>> del header # 6
  12. >>> del img
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement