To see the "raw binary data", I would use the hex dump command hd
$ 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.|
00000043
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
hdto 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