Tutorial :Creating RAW image file in Fortran


Is it possible to create a raw image in Fortran? I was thinking BMP but not really sure what extension would be best.

Basically, I want to be able to have an array or a text file that contains the color values for each pixel, so a 3 pixel wide red image would just be FF0000FF0000FF0000 or something similar to that


You could use the PPM format. http://en.wikipedia.org/wiki/Netpbm_format


Aspect 1: you have to know the format of the image file. Then you write that format. Likely any standard image files (PPM, BPM, TIFF,...) will include some sort of header. This is inherent in writing a standard image file, independent of the language.

Aspect 2: Fortran 2 used to be relentlessly record oriented, even for unformated (binary) files, which didn't "play" nicely with files written by other languages such as C, or file formats specified without the record deliminators expected by Fortran. But the new Stream I/O method produces non-record files. An image file will be unformatted (binary), so in the open statement include:

access='stream', form='unformatted', ....  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »