Created
June 27, 2014 01:09
-
-
Save theredpea/7d8e30f6716dd134e7be to your computer and use it in GitHub Desktop.
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
filepath = r'\\path\to\file\may\not\be\a\PNG.png' | |
filepath.replace('\\', '/') | |
f = open(filepath, mode='b') | |
b = f.read(8) | |
for _ in b: | |
print (_) | |
print (hex(_)) | |
#Notice the first two hex values are 42 and 4d; | |
#Consistent with BMP filetype (despite the extension), | |
#As shown here: http://yazeem.wordpress.com/2009/10/25/determine-image-file-type-using-its-header/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment