package imagelib

  1. Overview
  2. Docs
module Pixmap : sig ... end
type pixmap =
  1. | Grey of Pixmap.t
  2. | GreyA of Pixmap.t * Pixmap.t
  3. | RGB of Pixmap.t * Pixmap.t * Pixmap.t
  4. | RGBA of Pixmap.t * Pixmap.t * Pixmap.t * Pixmap.t
type image = {
  1. width : int;
  2. height : int;
  3. max_val : int;
  4. pixels : pixmap;
}
val create_rgb : ?alpha:bool -> ?max_val:int -> int -> int -> image

create_rgb ?alpha ?max_val width height is an RGB image of dimensions width * height. Raises Invalid_argument if width or height are negative, or if max_val is not in the range [1;65535].

val create_grey : ?alpha:bool -> ?max_val:int -> int -> int -> image

create_rgb ?alpha ?max_val width height is a greyscale image of dimensions width * height. Raises Invalid_argument if width or height are negative, or if max_val is not in the range [1;65535].

val read_rgba : image -> int -> int -> (int -> int -> int -> int -> 'a) -> 'a
val read_rgb : image -> int -> int -> (int -> int -> int -> 'a) -> 'a
val read_greya : image -> int -> int -> (int -> int -> 'a) -> 'a
val read_grey : image -> int -> int -> (int -> 'a) -> 'a
val write_rgba : image -> int -> int -> int -> int -> int -> int -> unit
val write_rgb : image -> int -> int -> int -> int -> int -> unit
val write_greya : image -> int -> int -> int -> int -> unit
val write_grey : image -> int -> int -> int -> unit
val fill_rgb : ?alpha:int -> image -> int -> int -> int -> unit

fill_rgb ?alpha image r g b overwrites image with r,g,b colors. TODO

val fill_alpha : image -> int -> unit
val copy : image -> image

copy image is a copy of image backed my a new memory allocation, so that the mutations of either copy are independent of each other

val compare_image : image -> image -> int
exception Corrupted_image of string
module type ReadImage = sig ... end
module type ReadImageStreaming = sig ... end
module type WriteImage = sig ... end
exception Not_yet_implemented of string
module Resize : sig ... end