bin2bmp – Convert binary files to bitmaps for visual inspection


bin2bmp <-i INPUT-FILE> [-w WIDTH] [-o OUTPUT-FILE] [-d DEPTH]
    [-v] [-r] [-t] [-T]


This script converts arbitrary files to bitmap images by encoding the binary data in the pixel values. This can be used for visual inspection of small and medium-sized (up to a few megabytes) files. Additionally, it is possible to reverse the encoding by means of the -r option.

Technically, larger files will work, too. Although there does not seem to be a good usecase for it, check section Issues with Large Files if interested.


-i INPUT-FILE Input filename (required)
-w WIDTH Width of output image (default is 1200)
-o OUTPUT-FILE Output filename (default is input_filename.png)
-d DEPTH Set color depth (24 default, 32 also possible)
-v   Display version and license information
-r   Restore input file a to binary file
-t   Write TGA instead of PNG images
-T   Write TIFF instead of PNG images


Display the source code as image

./bin2bmp -i bin2bmp -w 60 -o bin2bmp.png

Result of invoking the example command


Issues with Large Files


See Also Website 5 (1.0.2) – no Flash, no JavaScript, no Webfont, no Copy Protection, no Mobile First. No bullshit. No GUI needed. Works with any browser.

Created: 2020/12/23 00:18:14 | Revised: 2022/09/18 21:15:22 | Tags: mdvl, python, script, binary, image, bitmap | Version: 1.0.0 | SRC (Pandoc MD) | GPL

Copyright (c) 2020 For further info send an e-mail to

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <>.