Skip to content

gha3mi/forimage

Repository files navigation

GitHub Version Documentation CI_test cmake CI_doc License

ForImage

ForImage: A Fortran library for processing and editing PNM images and managing colors.

PNM File Support

ForImage offers comprehensive support for PNM files, including creation, importing, and exporting capabilities. It seamlessly handles formats such as PBM, PGM, and PPM in both ASCII and binary representations.

Available features include:

  • Original

demo

  • Negative

demo

  • Brighten

demo

  • Swap Channels

demo

  • Remove Channels

demo

  • Greyscale

demo

  • Rotate

demo

  • Flip Horizontal

demo

  • Flip Vertical

demo

  • Crop

demo

  • Resize

demo

Color Support

ForImage supports different color representations like RGB, CMYK, Decimal, Hexadecimal, HSV, HSL, XYZ, and color names. Users can easily set and retrieve color values, switch between color types, and find the closest matching colors.

demodemodemodemodemodemodemodemodemodemodemodemodemodemo

fpm dependency

If you want to use ForImage as a dependency in your own fpm project, you can easily include it by adding the following line to your fpm.toml file:

[dependencies]
forimage = {git="https://github.com/gha3mi/forimage.git"}

How to run demos

The demo_ppm program demonstrates various operations on PPM (Portable Pixmap) images. It generates Mandelbrot fractals, performs diverse manipulations, and exports images in the PPM format.

The demo_color program showcases manipulation of color spaces and their conversions. This program sets a custom color using various methods, converts it to different color spaces, retrieves color values, finds the nearest color, and prints color details.

To get started, follow these steps:

Clone the repository:

Clone the ForImage repository from GitHub using the following command:

git clone https://github.com/gha3mi/forimage.git

Navigate to the cloned directory:

cd forimage

Using fpm

Run the demo_ppm example:

fpm run --example demo_ppm

Run the demo_color example:

fpm run --example demo_color

Using CMake

cmake -B build -D BUILD_FORIMAGE_EXAMPLES=on
cmake --build build

Run the demo_ppm example:

./build/example/demo_ppm

Run the demo_color example:

./build/example/demo_color

Note: The executable must be run from the forimage directory.

Projects Utilizing ForImage

  • ForColormap: A Fortran library for colormaps
  • ForCAD: A Fortran library for Geometric Modeling using NURBS

If your project utilizes ForImage and you want to be added to this list, please add your project and create a pull request.

API documentation

The most up-to-date API documentation for the master branch is available here. To generate the API documentation for ForImage using ford run the following command:

ford ford.yml

Contributing

Contributions to ForImage are welcome! If you find any issues or would like to suggest improvements, please open an issue.

References