Grimage is a small library to read and save images in Caml Light.
It is freely available via FTP and HTTP.
High level interface with the Grimage library uses a generic image
format named grimage
. Images are converted to and from the
grimage
format, and then read and written to the file
system.
Grimage handles the following formats:
grimage__load_bmp_grimage filename
to load a BMP image
grimage__save_bmp_grimage filename grim
to save a
grimage
image as a BMP image
grimage__draw_grimage grim x y
to draw a BMP image
loaded as a grimage
value.
grimage__image_of_grimage
to convert to an image
of the Graphics module.
grimage__load_ppm_grimage filename
to load a PPM image
grimage__save_ppm_grimage filename ppm
to save a grimage
image as a PPM image
grimage__draw_grimage grim x y
to draw a PPM image
loaded as a grimage
value.
grimage__image_of_grimage
to convert to an image
of the Graphics module.
Elementary facilities to transform pixmaps (a color image represented as a matrix of R, G, B values) are provided by Grimage:
pixmap__bitmap_of_pixmap : int -> int -> pixmap
-> pixmap
maps a pixmap into a bitmap image.
pixmap__set_background_transp : pixmap -> unit
sets to
transparent the pixels of a pixmap whose color is the background color.
Low level use of the library is still possible via direct calls to
function from the Bmp
and Ppm
modules.
For more info about the library, read the interfaces of the modules and have a look to the test directory for working examples.