Previous: , Up: Foreign Functions   [Contents][Index]


65.6 FFI-bindings for libWand

The libWand library is the proposed API to the ImageMagick core. Depending on the configuration of ImageMagick it supports many, many different file formats for input and output and comes along with a powerful set of image manipulation commands.

Just like the bindings for libcurl the libWand bindings can be roughly classified into user-level functions and commands, currently there is only one command in this class, and low-level API calls.

65.6.1 Low-level functions of ffi-wand.el

Let us begin with context handlers.

Function: Wand:make-wand

Return a newly allocated MagickWand (the context handle of libWand).

Function: Wand:clear-wand wand

Clear all resources associated with the wand. This does not free the memory, i.e. wand can furtherly be used as a context, see Wand:delete-wand.

Function: Wand:copy-wand wand

Return a cloned copy of wand. This duplicates everything necessary to get an exact, but independent clone of wand.

Function: Wand:delete-wand wand

Delete the wand. This frees all resources associated with the wand.

WARNING: Do not use wand after calling this function!

Function: Wand:wandp wand

Return non-nil if wand is a magick wand, nil otherwise.

(setq foo (Wand:make-wand))
     ⇒ #<ffiobject type=MagickWand size=4 fotype=0 foptr=0x8b38350>
(Wand:wandp foo)
     ⇒ t
(Wand:delete-wand foo)
     ⇒ nil
(Wand:wandp foo)
     ⇒ nil

65.6.2 Input/Output functions of Wand context handles

Now here is an assortment of functions which operate on a Wand.

Function: Wand:read-image wand file

Read file and associate it with wand.

Function: Wand:write-image wand file

Write the image associated with wand to file.

Function: Wand:display-image wand

Display the image associated with wand.

Function: Wand:get-image-pixels-internal wand from-width from-height delta-width delta-height

Return a raw string of image pixel data (RGB triples).

Function: Wand:get-image-pixels wand

Return a raw string of image pixel data (RGB triples).

65.6.3 Image geometry and canvas functions

Function: Wand:get-image-height wand

Return the height of the image in wand in pixels.

Function: Wand:get-image-width wand

Return the width of the image in wand in pixels.

Function: Wand:scale-image wand width height

Scale the image in wand to the dimensions width times height.

Function: Wand:crop-image wand x y dx dy

Crop to the rectangle spanned at coordinates (x, y) by width dx and height dy in the image associated with wand.

Function: Wand:flip-image wand

Mirror the image associated with wand around the x-axis.

Function: Wand:flop-image wand

Mirror the image associated with wand around the y-axis.

Function: Wand:roll-image wand x y

Rolls (offsets) the image associated with wand to an offset of x and y.

65.6.4 Image refinement functions

Function: Wand:increase-contrast-image wand

Increase the contrast of the image associated with wand.

Function: Wand:decrease-contrast-image wand

Decrease the contrast of the image associated with wand.

Function: Wand:despeckle-image wand

Reduce the speckle noise in the image associated with wand.

Function: Wand:enhance-image wand

Enhance the image associated with wand.

Function: Wand:equalize-image wand

Equalise the image associated with wand.

Function: Wand:normalize-image wand

Normalise the image associated with wand.

Function: Wand:reduce-noise-image wand radius

Reduce the noise in the image associated with wand.

Function: Wand:posterize-image wand levels &optional ditherp

Posterize the image associated with wand, that is quantise the range of used colours to at most levels. If optional argument ditherp is non-nil use a dithering effect to wipe hard contrasts.

Function: Wand:gamma-image wand level

Perform gamma correction on the image associated with wand. The argument level is a positive float, a value of 1.00 (read 100%) is a no-op.

Function: Wand:median-filter-image wand radius

Perform median normalisation of the pixels in the image associated with wand.

Function: Wand:solarize-image wand threshold

Solarise the image associated with wand.

Function: Wand:modulate-image wand brightness saturation hue

Tweak the image associated with wand.

Function: Wand:negate-image wand &optional greyp

Perform negation on the image associated with wand.

65.6.5 Image effects functions

Function: Wand:charcoal-image wand radius sigma

Simulate a charcoal drawing of the image associated with wand. The radius argument is a float and measured in pixels. The sigma argument is a float and defines a derivation.

Function: Wand:oil-paint-image wand radius

Simulate oil-painting of image associated with wand. The radius argument is a float and measured in pixels.

Function: Wand:edge-image wand radius

Enhance the edges of the image associated with wand. The radius argument is a float and measured in pixels.

Function: Wand:emboss-image wand radius sigma

Emboss the image associated with wand (a relief effect). The radius argument is a float and measured in pixels. The sigma argument is a float and defines a derivation.

Function: Wand:wave-image wand amplitude wavelength

Create a ripple effect on the image associated with wand. The amplitude argument is a float and defines the how large waves are. The wavelength argument is a float and defines how often the waves occur.

65.6.6 Image blurring and sharpening functions

Function: Wand:blur-image wand radius sigma

Blur the image associated with wand. The radius argument is a float and measured in pixels. The sigma argument is a float and defines a derivation.

Function: Wand:gaussian-blur-image wand radius sigma

Blur the image associated with wand. The radius argument is a float and measured in pixels. The sigma argument is a float and defines a derivation.

Function: Wand:motion-blur-image wand radius sigma angle

Blur the image associated with wand. The radius argument is a float and measured in pixels. The sigma argument is a float and defines a derivation. The angle argument is a float and measured in degrees.

Function: Wand:radial-blur-image wand angle

Blur the image associated with wand. The angle argument is a float and measured in degrees.

Function: Wand:sharpen-image wand radius sigma

Sharpen the image associated with wand. The radius argument is a float and measured in pixels. The sigma argument is a float and defines a derivation.

Function: Wand:unsharp-mask-image wand radius sigma amount threshold

Sharpen the image associated with wand using an unsharp mask. The unsharp mask is defined by radius and sigma (defined as in Wand:blur-image). The strength of sharpening is controlled by amount and threshold.

65.6.7 User-level functions of ffi-wand.el

Mostly, for demonstration purposes, there are two functions which are claimed to be suitable for user interaction. The only operations they perform are reading an image file, rescaling it to fit into the window, glyphifying it and to insert that glyph into a buffer.

Function: Wand:show-image-file-here file

Insert a glyph with the image from file at current point, scale image to fit the buffer window if necessary.

Function: Wand:show-image-file file

Insert a glyph with the image from file in a dedicated buffer, scale image to fit the buffer window if necessary.


Previous: , Up: Foreign Functions   [Contents][Index]