Created
September 14, 2017 12:40
-
-
Save greymd/cfc37da72e7f2313b70d56eb68e6f0dc to your computer and use it in GitHub Desktop.
Bmp file analysis with ShellScript
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
# Extract size from information header. 14 is the octet length of file header. | |
od -tx1 -An flower.bmp \ | |
| tr -dc 'a-z0-9' \ | |
| fold -w 2 \ | |
| sed -n '14,15p' \ | |
| tr -d '\n' \ | |
| sed 's/./\U&/g;s/^/obase=10;ibase=16;/' \ | |
| awk 1 \ | |
| bc \ | |
| awk '{print $1+14}' | |
# File header -- 14 bytes | |
# Info header -- 124 bytes. | |
od -tx1 -An flower.bmp | tr -dc 'a-z0-9' | fold -w 2 | sed -n '139,$p' | tr -d '\n' | fold -w 6 | nl | |
## | |
## 307200 -- 640 * 480 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment