imagemagick

ImageMagick bindings for Kit - image processing and manipulation

Files

FileDescription
kit.tomlPackage manifest with metadata and dependencies
src/core.kitMagickWand FFI bindings and low-level wrappers
src/errors.kitError types for read, write, and operation failures
src/imagemagick.kitHigh-level API re-exports and module entry point
src/pipe.kitFluent pipe-friendly API with context chaining
tests/imagemagick.test.kitTests for error types and API function existence
examples/basic.kitLoad, resize, sharpen, and save an image
examples/filters.kitApply blur, edge, emboss, and charcoal effects
examples/pipe.kitChain operations using pipe-last operator
LICENSEMIT license file

Dependencies

No Kit package dependencies.

Installation

kit add gitlab.com/kit-lang/packages/kit-imagemagick.git

Usage

import Kit.Imagemagick

License

MIT License - see LICENSE for details.

Exported Functions & Types

ImageMagickError

ImageMagick error type for operation failures.

Variants

ImageMagickReadError {message}
ImageMagickWriteError {message}
ImageMagickOperationError {message}

Errors

Error types module - access via IM.Errors.ImageMagickError

read

Read an image from a file.

String -> Result Image ImageMagickError

write

Write an image to a file.

Image -> String -> Result Unit ImageMagickError

free

Free an image and release its resources.

Image -> Unit

clone

Clone an image.

Image -> Result Image ImageMagickError

width

Get image width in pixels.

Image -> Int

height

Get image height in pixels.

Image -> Int

depth

Get image depth in bits.

Image -> Int

resolution-string

Get resolution string "WIDTHxHEIGHT".

Image -> String

Print image information.

Image -> Unit

resize

Scale image (fast resize).

Image -> Int -> Int -> Result Unit ImageMagickError

flip

Flip image vertically.

Image -> Result Unit ImageMagickError

flop

Flip image horizontally.

Image -> Result Unit ImageMagickError

auto-orient

Auto-orient image based on EXIF data.

Image -> Result Unit ImageMagickError

strip

Strip metadata from image.

Image -> Result Unit ImageMagickError

negate

Negate (invert) colors.

Image -> Result Unit ImageMagickError

normalize

Normalize histogram.

Image -> Result Unit ImageMagickError

auto-level

Auto-level adjustment.

Image -> Result Unit ImageMagickError

auto-gamma

Auto-gamma adjustment.

Image -> Result Unit ImageMagickError

equalize

Equalize histogram.

Image -> Result Unit ImageMagickError

blur

Apply blur.

Image -> Float -> Float -> Result Unit ImageMagickError

gaussian-blur

Apply Gaussian blur.

Image -> Float -> Float -> Result Unit ImageMagickError

sharpen

Sharpen the image.

Image -> Float -> Float -> Result Unit ImageMagickError

edge

Detect edges.

Image -> Float -> Result Unit ImageMagickError

emboss

Apply emboss effect.

Image -> Float -> Float -> Result Unit ImageMagickError

charcoal

Apply charcoal effect.

Image -> Float -> Float -> Result Unit ImageMagickError

despeckle

Reduce noise (despeckle).

Image -> Result Unit ImageMagickError

enhance

Enhance image quality.

Image -> Result Unit ImageMagickError

is-landscape?

Check if image is landscape.

Image -> Bool

is-portrait?

Check if image is portrait.

Image -> Bool

is-square?

Check if image is square.

Image -> Bool

Pipe

Pipe-friendly context API module

read

Read an image and create a pipe context

Parameters:

Returns:

String -> Context

from-image

Create a context from an existing image

Parameters:

Returns:

Image -> Context

result

Get the final result from the pipe

Parameters:

Returns:

Context -> Result Unit ImageMagickError

has-error?

Check if context has an error

Parameters:

Returns:

Context -> Bool

is-ok?

Check if context is ok (no error)

Parameters:

Returns:

Context -> Bool

write

Write image to a file

Parameters:

Returns:

String -> Context -> Context

free

Free the image resources

Parameters:

Returns:

Context -> Context

clone

Clone the image

Parameters:

Returns:

Context -> Context

resize

Resize the image

Parameters:

Returns:

Int -> Int -> Context -> Context

flip

Flip image vertically

Parameters:

Returns:

Context -> Context

flop

Flip image horizontally

Parameters:

Returns:

Context -> Context

auto-orient

Auto-orient based on EXIF data

Parameters:

Returns:

Context -> Context

strip

Strip metadata

Parameters:

Returns:

Context -> Context

negate

Negate (invert) colors

Parameters:

Returns:

Context -> Context

normalize

Normalize histogram

Parameters:

Returns:

Context -> Context

auto-level

Auto-level adjustment

Parameters:

Returns:

Context -> Context

auto-gamma

Auto-gamma adjustment

Parameters:

Returns:

Context -> Context

equalize

Equalize histogram

Parameters:

Returns:

Context -> Context

blur

Apply blur

Parameters:

Returns:

Float -> Float -> Context -> Context

gaussian-blur

Apply Gaussian blur

Parameters:

Returns:

Float -> Float -> Context -> Context

sharpen

Sharpen the image

Parameters:

Returns:

Float -> Float -> Context -> Context

edge

Detect edges

Parameters:

Returns:

Float -> Context -> Context

emboss

Apply emboss effect

Parameters:

Returns:

Float -> Float -> Context -> Context

charcoal

Apply charcoal effect

Parameters:

Returns:

Float -> Float -> Context -> Context

despeckle

Reduce noise (despeckle)

Parameters:

Returns:

Context -> Context

enhance

Enhance image quality

Parameters:

Returns:

Context -> Context

Print image info (dimensions and depth)

Parameters:

Returns:

Context -> Context

width

Get image width (returns 0 on error)

Parameters:

Returns:

Context -> Int

height

Get image height (returns 0 on error)

Parameters:

Returns:

Context -> Int

depth

Get image depth (returns 0 on error)

Parameters:

Returns:

Context -> Int

is-landscape?

Check if image is landscape

Parameters:

Returns:

Context -> Bool

is-portrait?

Check if image is portrait

Parameters:

Returns:

Context -> Bool

is-square?

Check if image is square

Parameters:

Returns:

Context -> Bool

read

============================================================ High-Level API ============================================================

Read an image from a file.

String -> Result Image ImageMagickError

write

Write an image to a file.

Image -> String -> Result Unit ImageMagickError

free

Free an image and release its resources.

Image -> Unit

clone

Clone an image.

Image -> Result Image ImageMagickError

width

Get image width in pixels.

Image -> Int

height

Get image height in pixels.

Image -> Int

depth

Get image depth in bits.

Image -> Int

resolution-string

Get resolution string "WIDTHxHEIGHT".

Image -> String

Print image information.

Image -> Unit

resize

Scale image (fast resize).

Image -> Int -> Int -> Result Unit ImageMagickError

flip

Flip image vertically.

Image -> Result Unit ImageMagickError

flop

Flip image horizontally.

Image -> Result Unit ImageMagickError

auto-orient

Auto-orient image based on EXIF data.

Image -> Result Unit ImageMagickError

strip

Strip metadata from image.

Image -> Result Unit ImageMagickError

negate

Negate (invert) colors.

Image -> Result Unit ImageMagickError

normalize

Normalize histogram.

Image -> Result Unit ImageMagickError

auto-level

Auto-level adjustment.

Image -> Result Unit ImageMagickError

auto-gamma

Auto-gamma adjustment.

Image -> Result Unit ImageMagickError

equalize

Equalize histogram.

Image -> Result Unit ImageMagickError

blur

Apply blur.

Image -> Float -> Float -> Result Unit ImageMagickError

gaussian-blur

Apply Gaussian blur.

Image -> Float -> Float -> Result Unit ImageMagickError

sharpen

Sharpen the image.

Image -> Float -> Float -> Result Unit ImageMagickError

edge

Detect edges.

Image -> Float -> Result Unit ImageMagickError

emboss

Apply emboss effect.

Image -> Float -> Float -> Result Unit ImageMagickError

charcoal

Apply charcoal effect.

Image -> Float -> Float -> Result Unit ImageMagickError

despeckle

Reduce noise (despeckle).

Image -> Result Unit ImageMagickError

enhance

Enhance image quality.

Image -> Result Unit ImageMagickError

is-landscape?

Check if image is landscape.

Image -> Bool

is-portrait?

Check if image is portrait.

Image -> Bool

is-square?

Check if image is square.

Image -> Bool