Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. import sys
  2.  
  3. with open(sys.argv[1], "rb") as file:
  4. file.seek(0x1c)
  5. color_depth = file.read(1)[0] | file.read(1)[0] << 8
  6. print("Color depth:", color_depth)
  7.  
  8. file.seek(0x1e)
  9. compression = file.read(1)[0] | file.read(1)[0] << 8
  10. print("Compression:", compression)
  11.  
  12. file.seek(0x2e)
  13. colors = file.read(1)[0] | file.read(1)[0] << 8 | file.read(1)[0] << 16 | file.read(1)[0] << 24
  14. print("Colors:", colors)
  15.  
  16. print("Is true color BMP: ", colors == 0 and color_depth >= 16)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement