Module Genimg_loader


module Genimg_loader: sig .. end
Generic image loader


This module uses the ImageMagick library, which can read a lot of different images file formats. The complete list of these is available on this web-page.

If the image to load is known to be a jpeg, you should use the module Jpeg_loader instead which will be far more efficient.

type image_type =
| Undefined_image_type
| Bilevel (*Monochrome image*)
| Grayscale
| GrayscaleMatte (*Grayscale image with an alpha channel*)
| Palette (*Indexed colors*)
| PaletteMatte (*Indexed colors + Alpha*)
| TrueColor (*RGB*)
| TrueColorMatte (*RGBA*)
| ColorSeparation (*Cyan/Yellow/Magenta/Black (CYMK)*)
| ColorSeparationMatte (*CYMK + Alpha*)
| Optimize

type img_input =
| Filename of string
| Buffer of string

val load_img : img_input ->
(int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Genarray.t *
int * int * int * image_type

The 3 additionnal integers are width, height and the number of color_components.
val assert_size : width:int -> height:int -> unit

Checks if the dimensions of the image are compatible with OpenGL.