package bimage-gtk

  1. Overview
  2. Docs
Bimage_gtk allows images to be displayed in GTK windows

Install

Dune Dependency

Authors

Maintainers

Sources

v0.1.tar.gz
md5=d99320389cab8e85c6021c96cc98cb7c
sha512=d98d334eff3f077b9aadc5c082809976b79902d2d31788d8e40e9773687d0c8678030cb8efc71581822a46afeac92d34ab8933f5507bceea6cd7e38e78456334

Description

An image processing library for OCaml providing efficient, composable operations. Additionally, bimage supports most types supported by Bigarray.

Tags

image processing gtk

Published: 23 Jan 2019

README

bimage — Image processing library

%%VERSION%%

bimage is an image processing library for OCaml.

Features

  • Simple image type based on bigarrays

  • Supports u8, u16, i32, i64, f32, f64, complex32 and complex64 datatypes

  • Multiple layout support (Planar/Interleaved)

  • Composable image operations

  • Image I/O using ImageMagick/GraphicsMagick and FFmpeg in (bimage-unix)

  • Support for displaying images using GTK (bimage-gtk) or SDL (bimage-sdl)

bimage is distributed under the ISC license.

Homepage: https://github.com/zshipko/bimage

Installation

bimage can be installed with opam:

opam install bimage

Additionally, bimage-unix, which provides ImageMagick and FFmpeg bindings, can be installed by running:

opam install bimage-unix

If you don't use opam consult the opam file for build instructions.

Examples

An example showing how to create an image and how to use Image.for_each:

open Bimage

let _ =
(* Create a new image *)
let a = Image.create u8 gray 64 64 in

(* Iterate over each pixel *)
let _ =
    Image.for_each (fun x y _px ->
        set a x y (x + y)
    ) a
in

(* Save the image using ImageMagick *)
Bimage_unix.Magick.write "test1.jpg" a

An example using Op.t to run a filter on an image:

open Bimage
open Bimage_unix

let _ =
(* Load an image using ImageMagick *)
let Some a = Magick.read "test/test.jpg" f32 rgb in

(* Create an operation to convert to grayscale and subtract 1.0 *)
let f = Op.(grayscale &- scalar 1.0) in

(* Create a destination image *)
let dest = Image.like f32 gray a in

(* Run the operation *)
let () = Op.eval f dest [| a |] in

(* Save the image using ImageMagick *)
Magick.write "test2.jpg" a

Documentation

The documentation and API reference is generated from the source interfaces. It can be consulted online or via odig doc bimage.

Tests

In the distribution sample programs and tests are located in the test directory. They can be built and run with:

dune runtest

Dependencies (5)

  1. cairo2 >= "0.6"
  2. lablgtk >= "2.18"
  3. bimage = version
  4. dune
  5. ocaml >= "4.03.0"

Dev Dependencies

None

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.