Created
October 5, 2019 01:08
-
-
Save oddstr13/8be1533f769379c63d1f9eaa1c0ff781 to your computer and use it in GitHub Desktop.
This file contains 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
import sys | |
with open(sys.argv[1], "rb") as file: | |
file.seek(0x1c) | |
color_depth = file.read(1)[0] | file.read(1)[0] << 8 | |
print("Color depth:", color_depth) | |
file.seek(0x1e) | |
compression = file.read(1)[0] | file.read(1)[0] << 8 | |
print("Compression:", compression) | |
file.seek(0x2e) | |
colors = file.read(1)[0] | file.read(1)[0] << 8 | file.read(1)[0] << 16 | file.read(1)[0] << 24 | |
print("Colors:", colors) | |
print("Is true color BMP: ", colors == 0 and color_depth >= 16) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment