package mosaique

  1. Overview
  2. Docs

Module MosaiqueSource

OCaml bindings for libvips image processing library

Types

Sourcetype t

Opaque type representing a vips image

Sourcetype format =
  1. | JPEG of int
    (*

    JPEG with quality 1-100

    *)
  2. | PNG
    (*

    PNG format

    *)
  3. | WEBP of int
    (*

    WebP with quality 1-100

    *)

Image format for saving

Core Functions

Sourceval shutdown : unit -> unit

Shutdown the vips library. Should be called at program exit.

Image Loading and Saving

Sourceval load : string -> t

Load an image from file

Sourceval save : t -> format -> string -> unit

Save an image to file with specified format

Image Information

Sourceval width : t -> int

Get image width in pixels

Sourceval height : t -> int

Get image height in pixels

Sourceval bands : t -> int

Get number of bands (channels) in the image

Image Operations

Sourceval resize : t -> width:int -> height:int -> t

Resize image to specified width and height

Sourceval rotate : t -> float -> t

Rotate image by specified angle in degrees

Sourceval grayscale : t -> t

Convert image to grayscale

Sourceval flip_horizontal : t -> t

Flip image horizontally

Sourceval flip_vertical : t -> t

Flip image vertically

Error Handling

Sourceexception Vips_error of string

Exception raised by vips operations