Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The image format is an ascii text, with numbers separated by spaces (black & white image). Per number per pixel. Is there any way to view this image by some application? I know I can write codes to view it, but I'm just wondering is there any existing software doing this.

Better open source and free.

share|improve this question

closed as off-topic by DavidPostill, Josh, Deltik, Patches, random May 1 at 1:36

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking product, service, or learning material recommendations are off-topic because they become outdated quickly and attract opinion-based answers. Instead, describe your situation and the specific problem you're trying to solve. Share your research. Here are a few suggestions on how to properly ask this type of question." – DavidPostill, Josh, Deltik, Patches, random
If this question can be reworded to fit the rules in the help center, please edit the question.

You can easily convert such a text file to a PGM file by adding some header information using a text editor.

For example, the following PGM file is an 8x8 image containing 2x2 black and white checkerboard.

P2
8 8
1
0 0 1 1 0 0 1 1
0 0 1 1 0 0 1 1
1 1 0 0 1 1 0 0
1 1 0 0 1 1 0 0
0 0 1 1 0 0 1 1
0 0 1 1 0 0 1 1
1 1 0 0 1 1 0 0
1 1 0 0 1 1 0 0

Here, P2 defines the type of image (Portable greymap in ASCII), the next line defines the width and height and the third line defines the maximum grey level. The remaining lines are the actual image data.

PGM is one of the Netpbm formats, which have surprisingly good support on most operating systems and graphics applications due to their very simple formats.

share|improve this answer
    
Thanks for your answer. However, my situation may be a little bit different. The ascii file contains a matrix with float number element, not only 0 and 1. Do you have any suggestions? Thanks. – xuhdev Jan 3 '13 at 3:37
    
There are image formats that support floating point formats but they all tend to store the data in binary rather than ASCII representation of floating point. PGM is the only common file format I'm aware of that supports ASCII. It will support 16 bit greyscale so if you can rescale your data (using Excel or a script maybe) to integers between 0 and 65535 then PGM would still be viable. – Mike Fitzpatrick Jan 3 '13 at 4:23
    
Thanks. I think it might be easier for me to write a script to render the image directly than convert it into an existing format. – xuhdev Jan 4 '13 at 5:33

Not the answer you're looking for? Browse other questions tagged .