Complex plotting program made in fortran

I had been learning fortran for a little over half a year now. I only just joined the discourse today, but I had been reading here since I have started learning.

For the past couple of months, I had been working on a program that does complex plotting. I started making it in fortran since it had a complex type. Complex numbers don’t just map to RGB values, you need to start in a more spherical color space. I was originally going to use HSI, but I didn’t want to write the conversion code to rgb. So I started in the cieLCHab space. Then taking a trip to cieLab, then cieXYZ then finally sRGB. I also wrote a domain coloring subroutine that started in cieLCHuv space. I liked how the cieLCHuv one looked over the one that used cieLCHab, so I only kept the cieLCHuv one. By then, the pfm files I was writing out was getting quite big. 48MB big. So I needed to move to something smaller. I chose tiffs for this. Now I could apply compression. To handle that I linked against interkosmos’s fortran-zlib bindings. That got the images down to 38-40MBs. That was better, but I wanted more. So I next added logLu’v’ tiff support. This was very difficult as logLu’v’ uses adaptive run-length encoding. I had to write it from scratch. I dealt with many heap-buffer-overflows, but everything turned out to be a fencepost error. So now images are about 5ish MB, a great deal better than the original 48MB.

Now that I have it writing out logluv tiffs, I figured its about time to share it. I GPLed it, so I don’t get any weird emails 30 years later. I wrote some basic documentation this morning, and now I am finally sharing it.

To everyone here who has helped without knowing it, Thank You.

6 Likes

In Modern Fortran explained Modern Fortran Explained (2023) now published it says that there is a convention to use f90 file extension everything past Fortran 90 standard. I see in your code you use f08 so you might want to consider changing that.

Have you tried/considered to use fpm for building the project?

Your project looks very interesting.

1 Like

Welcome @Dotz0cat and thanks for sharing your library,

I suggest that you add an example picture in the README to make the project more appealing (but compressed with JPEG for example to keep the repository small).

It is always frustrating to find a project plotting or drawing something, without seeing the result… :wink:

I have changed it to f90 now.

I haven’t fully considered using it. I tend to like sticking to makefiles.

Both suggestions taken. I added 2 example images to my README. I spent who knows how long trying to get them into place before breaking down and using a table.

2 Likes