Quick visualization of a binary file

• Posted by hugsy on December 2, 2018
• cheatsheet • binary • visualization

Here’s a simple trick that I learned from the amazing @scanlime to quickly (and universally) visualize the distribution of byte of any binary file, using the Portable Graymap Format (PGM) format.

On Windows:

C:\> echo P5 512 4096 255 > %TEMPDIR%\visu.pgm & ^
     type \path\to\file\to\visualize.whatever >> %TEMPDIR%\visu.pgm

Or on Linux/OSX:

$ (echo "P5 512 4096 255";
   cat /path/to/file/to/visualize.whatever) > /tmp/visu.pgm

Then open the file with any image viewer like feh or IrFanView.


Share this post: