GSRM

GSRM

Steve:

I started looking at the second program by Professor Bird, called GSRM.

The program compiled first time on the 2015 beta in debug mode.

Easy well written code to follow and amend.  I now have an array on double precision numbers, 1801 by 3601 exactly.

It is straightforward in  C# to draw the output data on a jpg file, I do this a lot. In Fortran I used to draw as DXF Files, but C# is so easy being able to poke the values into the points on the JPG file.

1. Can I write to a JPG type format in Fortran? I will convert the reals to integer steps as required.

2. If not, what is the "easiest" way to transfer the array from Fortran to C#. I have several working programs that do sort of this stuff, but it is horribly convoluted, is there an easy way. the alternative is to write to a file and then read it, but that is not nice.  Having the pictures makes it a lot easier to understand the output compared to an array of 1800 by 3600 reals.

JMN

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Paul Curtis's picture

Suggestion: it is much easier to create/save a .BMP image than a .JPG, and this is easily done directly from IVF.  BMPs are direct {r,g,b} pixellations which do not alter the image content, whereas JPGs involve lots of algorithm (complex coding) and are lossy, so the resulting image is only an approximation of the original data when the actual pixel values are important (example: long time ago I did ratio fluorescence imagery, where each pixel in the ratio image represented a chemical concentration, and any algorithmic tomfoolery would change the science).  You can also map your data values onto a "perceptually correct rainbow" of colors for maximum visual impact.

Can you make it a Quickwin project? If so, it is simple (trivial even) to create a window of size 1801 x 3601 pixels, and color every one of them according to the RGB formula; then save it to a bmp image using SAVEIMAGE. I do it all the time.

I agree completely with Paul regarding the suitability of bmp files. JPG, although better known, are simply not suited to technical information. BMP files are unfortunately much larger. When I want a smaller file, I call a utility such as Irfinview, programmitically, which can convert the bmp file to tif or gif.

I'm sure if you're a windows programmer (like Paul) it is equally easy without Quickwin.

Dear All:

I spent some time looking for some code that already existed. I found some code at a University website, which is short sharp and to the point.

The problem is of course having to get your hands dirty - so to speak in dealing with the code.

It ran first time on 2015 beta, gave me nice bit map images, which is ok, one can always save.

I will write a simple subroutine to pass in the array and then set the colours. 

Thanks

JMN

! --------------------------------------------
! Sample FORTRAN 77 program to make PPM / BMP
!
!  1998-Apr-03 (long long ago)
!      :
!  2005-Jul-22 (added P3)
!      :
!  2006 Dec-22 (added BMP)
!
!  Image array rgb(3,!,!) is filled in subroutine mkbitmap()
!  and
!  saved in PPM or BMP format in subroutine pixout().
!
!                                   K. Hayashi
! --------------------------------------------
!

 

Login to leave a comment.