vmagnin / forcolormap

A Fortran library for colormaps
https://vmagnin.github.io/forcolormap/
MIT License
21 stars 4 forks source link

Add Support lut File Format #9

Open gha3mi opened 8 months ago

gha3mi commented 8 months ago

I noticed the idea of lut files in the TODO list. I have added support for the lut file format in ForImage. Examples of this functionality can be found at the following links: example15 and example16.

If you believe ForColormap is the appropriate place for this functionality, I can move it there.

Now, it is possible to import and export lut files. We can implement support for importing and exporting lut files in ForColormap by adding two type-bound procedures. What's your opinion?

vmagnin commented 8 months ago

Well, it depends on what future developments you envision in ForImage. Personally I would have put it in ForColormap because I can't see what .lut (ImageJ) files could bring except managing colormaps. But maybe you have more ideas and anyway as ForImage is a dependency, ForColormap will also have access...

My idea is that the user could create a colormap with its own routine or use built-in routines that we could later add to create specific kinds of colormaps. And he could be interested to export it, for example for use with another software.

On my side, amongst the development I could imagine in ForImage I see things like:

Maybe we could then imagine a ForPlot project using it to make some basic plotting...

gha3mi commented 8 months ago

Thank you for sharing your ideas. I completely agree with your vision for ForImage. Drawing methods for shapes, anti-aliasing, filters, layer management, and transformations like rotations and mirrors are all valuable features. In my initial plans for ForImage, I intended to support importing, exporting and converting various file formats. PNM files were the easiest to implement, which is why I started with them. However, formats like PNG, SVG, JPEG, and others require the use of C libraries, and unfortunately, I haven't had enough time to implement these libraries yet.

Regarding transformations, I believe I have already implemented some features in ForImage. I'll need to delve into my development branches to locate them and merge them into the main ForImage branch. However, for other features like filters and anti-aliasing, I might lack the necessary expertise.

If I find some time, I will implement support for lut and Paraview XML files for ForColormap.

I'm excited about the prospect of ForPlot in the future. :)

vmagnin commented 8 months ago

I think I have already seen a Fortran project writing in the PNG format, but not sure. But the more important thing is to have Fortran tools to draw bitmaps. For saving, PNM files are sufficient, and if you need a compressed format to save space it is always possible to call external command line tools for conversion.

Just concentrate on the features you need more and you have the expertise for, and you will see later if you can add more or if someone can contribute. The important thing is to have the essential basic functions.

Concerning a ForPlot project, after you have a library for drawing, the main problem I see is fonts to write for example axis titles... You can not access easily the OS fonts without C libraries. But maybe there exist some collections of bitmap fonts that could be imported in a Fortran module, and with the right license.

Thanks again for all your contributions to ForColormap!