Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Does there exist a program for Linux that can display raw binary data?

Each byte in my binary files represent a pixel, so it would be very useful if something like this exists where I could say

program_name --input=dat001.bin --width=200 --height=100

and it would display the pixels.

I wonder if gnuplot, can be used for this...?

share|improve this question
Question does not make sense. To display raw binary data, it must be converted to a human readable form. Usually this form is hexadecimal, which you can use hd to format. Then you ask to see an image. If it is an image, then it is going to be in an image format ( like bmp ) that will at the very least, have a header that identifies the format, the width, height, color depth, and maybe also have a color palette attached. –  psusi Jun 8 '11 at 1:12
@psusi While the title would be better How to display raw pixel data, the intent of this question is clear, and totally makes sense to me. ("I want a program to let me specify the image meta data") Does it make more sense in hindsight (or perhaps after editing) to you also? –  Nathan Kidd 12 hours ago

3 Answers 3

up vote 5 down vote accepted

Okay, gnuplot can do it.


share|improve this answer

To see the "raw binary data", I would use the hex dump command hd or hexdump

$ hd -C a.txt
00000000  61 0a 61 61 0a 61 61 61  0a 61 61 61 61 0a 61 61  |a.aa.aaa.aaaa.aa|
00000010  61 61 61 0a 62 62 62 0a  62 62 62 62 0a 62 62 62  |aaa.bbb.bbbb.bbb|
00000020  62 62 0a 3c 62 65 67 69  6e 3e 0a 61 61 61 61 61  |bb.<begin>.aaaaa|
00000030  61 0a 61 61 61 61 61 61  61 0a 61 61 61 61 61 61  |a.aaaaaaa.aaaaaa|
00000040  61 61 0a                                          |aa.|

I don't know of any image format that consists of unstructured bytes - is the data 8-bit RGB values? If the file contains 30000 bytes is that RGB for 100x100 pixels or RGB for 50x200 pixels or RGB for 200x50 pixels or something else? Is there a palette? You have to know something about the organisation of the data!

To view it as an image I would use the NetPBM utilities or maybe ImageMagick to convert it to a form understood by an image viewer

If the above can't do the job I'd investigate writing a small Perl script

share|improve this answer
Where can I get this? I just did yum search hd on my Fedora desktop, and it didn't have it. –  Sandra Jun 7 '11 at 23:36
OKay. I need to see the pxiels as graphic... –  Sandra Jun 7 '11 at 23:37
The binary might be called hexdump. On SuSE it is in the util-linux package. –  Turbo J Jun 8 '11 at 0:30
FWIW it's also hexdump in Arch. –  Sparhawk Oct 11 '14 at 12:20

If not wanting to view it directly but rather convert it the convert utility can do this:

To read from stdin, assuming 320 x 200 pixels, 8 bit gray, header of 0, saving to pic.png in PNG format.

convert -depth 8 -size 320x200+0 gray:- pic.png
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.