Skip to content

Instantly share code, notes, and snippets.

@jtomori
Last active December 4, 2019 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtomori/7b68397e95f606cf770d5fbed4bfb020 to your computer and use it in GitHub Desktop.
Save jtomori/7b68397e95f606cf770d5fbed4bfb020 to your computer and use it in GitHub Desktop.
Peek into a .bmp file
$ dd if=img.bmp bs=1 skip=54 status=none | xxd -g 3 -c 12

bs=1 - Block size of 1 byte

skip=54 - Skips first 54 bytes, which is header info

status=none - Hide debug information

-g 3 - Group by 3 bytes (RGB triplet)

-c 12 - Display 4 pixels per row, $ file img.bmp shows resolution information. Pixel padding needs to be included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment