imagemagick-0.0.4.1: bindings to imagemagick library

Safe HaskellNone
LanguageHaskell98

Graphics.ImageMagick.MagickWand.FFI.MagickWand

Contents

Synopsis

Documentation

magickWandGenesis :: IO () Source

MagickWandGenesis() initializes the MagickWand environment.

magickWandTerminus :: IO () Source

MagickWandTerminus() terminates the MagickWand environment.

Constructing magic wand

newMagickWand :: IO (Ptr MagickWand) Source

NewMagickWand() returns a wand required for all other methods in the API. A fatal exception is thrown if there is not enough memory to allocate the wand. Use DestroyMagickWand() to dispose of the wand when it is no longer needed.

newMagickWandFromImage Source

Arguments

:: Ptr Image

Image

-> IO (Ptr MagickWand) 

NewMagickWandFromImage() returns a wand with an image.

cloneMagickWand :: Ptr MagickWand -> IO (Ptr MagickWand) Source

CloneMagickWand() makes an exact copy of the specified wand.

Clearing and destroying

clearMagickWand :: Ptr MagickWand -> IO () Source

ClearMagickWand() clears resources associated with the wand, leaving the wand blank, and ready to be used for a new set of images.

destroyMagickWand :: Ptr MagickWand -> IO (Ptr MagickWand) Source

DestroyMagickWand() deallocates memory associated with an MagickWand.

pDestroyMagickWand :: FunPtr (Ptr MagickWand -> IO ()) Source

Utilities

isMagicWand :: Ptr MagickWand -> IO MagickBooleanType Source

IsMagickWand() returns MagickTrue if the wand is verified as a magick wand.

Exceptions

magickClearException :: Ptr MagickWand -> IO MagickBooleanType Source

MagickClearException() clears any exceptions associated with the wand.

magickGetException :: Ptr MagickWand -> Ptr ExceptionType -> IO CString Source

MagickGetException() returns the severity, reason, and description of any error that occurs when using other methods in this API.

magickGetExceptionType :: Ptr MagickWand -> IO ExceptionType Source

MagickGetExceptionType() returns the exception type associated with the wand. If no exception has occurred, UndefinedExceptionType is returned.

magickGetIteratorIndex :: Ptr MagickWand -> IO CSize Source

MagickGetIteratorIndex() returns the position of the iterator in the image list.

Image functions

magickNextImage :: Ptr MagickWand -> IO MagickBooleanType Source

MagickNextImage() sets the next image in the wand as the current image. It is typically used after MagickResetIterator(), after which its first use will set the first image as the current image (unless the wand is empty).

It will return MagickFalse when no more images are left to be returned which happens when the wand is empty, or the current image is the last image.

When the above condition (end of image list) is reached, the iterator is automatically set so that you can start using MagickPreviousImage() to again iterate over the images in the reverse direction, starting with the last image (again). You can jump to this condition immeditally using MagickSetLastIterator().

magickPreviousImage :: Ptr MagickWand -> IO MagickBooleanType Source

MagickPreviousImage() sets the previous image in the wand as the current image.

It is typically used after MagickSetLastIterator(), after which its first use will set the last image as the current image (unless the wand is empty).

It will return MagickFalse when no more images are left to be returned which happens when the wand is empty, or the current image is the first image. At that point the iterator is than reset to again process images in the forward direction, again starting with the first image in list. Images added at this point are prepended.

Also at that point any images added to the wand using MagickAddImages() or MagickReadImages() will be prepended before the first image. In this sense the condition is not quite exactly the same as MagickResetIterator().

magickResizeImage Source

Arguments

:: Ptr MagickWand 
-> CSize

the number of columns in the scaled image

-> CSize

the number of rows in the scaled image

-> FilterTypes

filter

-> CDouble

blur factor where 1 > blurry, < 1 sharp

-> IO MagickBooleanType 

MagickResizeImage() scales an image to the desired dimensions with one of these filters:

Most of the filters are FIR (finite impulse response), however, Bessel, Gaussian, and Sinc are IIR (infinite impulse response). Bessel and Sinc are windowed (brought down to zero) with the Blackman filter.

magickWriteImages Source

Arguments

:: Ptr MagickWand 
-> CString

filename

-> MagickBooleanType

join images into a single multi-image file.

-> IO MagickBooleanType 

MagickWriteImages() writes an image or image sequence.

magickSetSize Source

Arguments

:: Ptr MagickWand 
-> CSize

columns

-> CSize

rows

-> IO MagickBooleanType 

MagickSetSize() sets the size of the magick wand. Set it before you read a raw image format such as RGB, GRAY, or CMYK.

magickGetSize Source

Arguments

:: Ptr MagickWand 
-> Ptr CSize

the width in pixels

-> Ptr CSize

the height in pixels

-> IO MagickBooleanType 

MagickGetSize() returns the size associated with the magick wand.

magickGaussianBlurImage Source

Arguments

:: Ptr MagickWand 
-> CDouble

radius

-> CDouble

sigma

-> IO MagickBooleanType 

MagickGaussianBlurImage() blurs an image. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, the radius should be larger than sigma. Use a radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.

magickGaussianBlurImageChannel Source

Arguments

:: Ptr MagickWand 
-> ChannelType 
-> CDouble

radius

-> CDouble

sigma

-> IO MagickBooleanType 

magickSetImageArtifact :: Ptr MagickWand -> CString -> CString -> IO MagickBooleanType Source

MagickSetImageArtifact() associates a artifact with an image. The format of the MagickSetImageArtifact method is:

magickDeleteImageArtifact :: Ptr MagickWand -> CString -> IO MagickBooleanType Source

MagickDeleteImageArtifact() deletes a wand artifact.

magickSetIteratorIndex Source

Arguments

:: Ptr MagickWand 
-> CSize

the scene number

-> IO MagickBooleanType 

MagickSetIteratorIndex() set the iterator to the given position in the image list specified with the index parameter. A zero index will set the first image as current, and so on. Negative indexes can be used to specify an image relative to the end of the images in the wand, with -1 being the last image in the wand.

If the index is invalid (range too large for number of images in wand) the function will return MagickFalse, but no exception will be raised, as it is not actually an error. In that case the current image will not change.

After using any images added to the wand using magickAddImage or magickReadImage will be added after the image indexed, regardless of if a zero (first image in list) or negative index (from end) is used.

Jumping to index 0 is similar to magickResetIterator but differs in how magickNextImage behaves afterward.

magickResetIterator :: Ptr MagickWand -> IO () Source

MagickResetIterator() resets the wand iterator.

It is typically used either before iterating though images, or before calling specific functions such as magickAppendImages to append all images together.

Afterward you can use magickNextImage to iterate over all the images in a wand container, starting with the first image.

Using this before magickAddImages or magickReadImages will cause new images to be inserted between the first and second image.

magickSetFirstIterator :: Ptr MagickWand -> IO () Source

MagickSetLastIterator() sets the wand iterator to the last image. The last image is actually the current image, and the next use of MagickPreviousImage() will not change this allowing this function to be used to iterate over the images in the reverse direction. In this sense it is more like MagickResetIterator() than MagickSetFirstIterator(). Typically this function is used before MagickAddImage(), MagickReadImage() functions to ensure new images are appended to the very end of wand's image list.

magickSetLastIterator :: Ptr MagickWand -> IO () Source

MagickSetFirstIterator() sets the wand iterator to the first image. After using any images added to the wand using MagickAddImage() or MagickReadImage() will be prepended before any image in the wand. Also the current image has been set to the first image (if any) in the Magick Wand. Using MagickNextImage() will then set teh current image to the second image in the list (if present). This operation is similar to MagickResetIterator() but differs in how MagickAddImage(), MagickReadImage(), and MagickNextImage() behaves afterward.

magickRelinquishMemory :: Ptr () -> IO () Source

MagickRelinquishMemory() relinquishes memory resources returned by such methods as MagickIdentifyImage(), MagickGetException(), etc.