Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bmp file analysis with ShellScript
# 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
You can’t perform that action at this time.