\title{C API Methods}
\toctitle{C API Methods}
\titlerunning{C API Methods}
\maketitle

\section{Methods to Constitute an Image}

\subsection{ConstituteImage}

Method ConstituteImage is a convenience routine that creates an image from the pixel data you supply and returns it.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.  The pixel data must be in scanline order top-to-bottom.  The data can be character, short int, integer, float, or double.  Float and double require the pixels to be normalized [0..1]. The other types are [0..MaxRGB]. For example, to create a 640x480 image from unsigned red-green-blue character data, use

{\em image=ConstituteImage (640, 480, "RGB", 0, pixels, \&exception) }

\smallskip

{\em Image \*ConstituteImage (const unsigned int width, const unsigned int height, const char \*map, const StorageType type, const void \*pixels, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{image}]

Method Constitute returns a pointer to the image.  A null image is returned if there is a memory shortage or if the image cannot be read.

\item[\textit{width}]

Specifies the width in pixels of the image.

\item[\textit{height}]

Specifies the height in pixels of the image.

\item[\textit{map}]

This character string can be any combination or order of R = red, G = green, B = blue, A = alpha, C = cyan, Y = yellow, M = magenta, and K = black.  The ordering reflects the order of the pixels in the supplied pixel array.

\item[\textit{type}]

pixel type where 0 = unsigned char, 1 = short int, 2 = int, 3 = float, and 4 = double.  Float and double types are expected to be normalized [0..1] otherwise [0..MaxRGB].

\item[\textit{pixels}]

This array of values contain the pixel components as defined by the map and type parameters.  The length of the arrays must equal the area specified by the width and height values and type parameters.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{DispatchImage}

Method DispatchImage is a convenience routine.  Use it to extract pixel data from an image and place it in a buffer you supply.  The data is saved either as char, short int, integer, float or double format in the order specified by the type parameter.  For example, we want to extract scanline 1 of a 640x480 image as character data in red-green-blue order:

{\em DispatchImage (image, 0, 0, 640, 1, "RGB", 0, pixels) }

\smallskip

{\em unsigned int DispatchImage (Image \*image, const int x, const int y, const unsigned int columns, const unsigned int rows, const char \*map, const StorageType type, void \*pixels) }

\smallskip

\begin{description}

\item[\textit{image}]

Specifies a pointer to a Image structure returned from ReadImage.

\item[\textit{x,y,columns,rows}]

These values define the perimeter of a region of pixels you want to extract.

\item[\textit{map}]

This character string can be any combination or order of R = red, G = green, B = blue, A = alpha, C = cyan, Y = yellow, M = magenta, and K = black.  The ordering reflects the order of the pixels in the supplied pixel array.

\item[\textit{type}]

pixel type where 0 = unsigned char, 1 = short int, 2 = int, 3 = float, and 4 = double.  Float and double types are expected to be normalized [0..1] otherwise [0..MaxRGB].

\item[\textit{pixels}]

This array of values contain the pixel components as defined by the map and type parameters.  The length of the arrays must equal the area specified by the width and height values and type parameters.

\end{description}

\subsection{PingImage}

Method PingImage returns the image size in bytes if it exists and can be the image is returned as well.  Note, only the first image in a multi-frame image file is pinged.


\smallskip

{\em Image \*PingImage (const ImageInfo \*image\_info, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{Image}]

Method PingImage returns the image size in bytes if the image file exists and it size can be determined otherwise 0.

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{ReadImage}

Method ReadImage reads an image and returns it.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.  By default, the image format is determined by its magic number.  To specify a particular image format, precede the filename with an explicit image format name and a colon (i.e.  ps:image) or as the filename suffix (i.e.  image.ps).


\smallskip

{\em Image \*ReadImage (const ImageInfo \*image\_info, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{image}]

Method ReadImage returns a pointer to the image after reading.  A null image is returned if there is a memory shortage or if the image cannot be read.

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{ReadImages}

Method ReadImages reads a list of image names from a file and then returns the images as a linked list.


\smallskip

{\em Image \*ReadImages (const ImageInfo \*image\_info, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{image}]

Method ReadImage returns a pointer to the image after reading.  A null image is returned if there is a memory shortage or if the image cannot be read.

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\end{description}

\subsection{WriteImage}

Method WriteImage writes an image to a file as defined by image->filename.  You can specify a particular image format by prefixing the file with the image type and a colon (i.e.  ps:image) or specify the image type as the filename suffix (i.e.  image.ps). The image may be modified to adapt it to the requirements of the image format.  For example, DirectClass images must be color-reduced to PseudoClass if the format is GIF.


\smallskip

{\em unsigned int WriteImage (const ImageInfo \*image\_info, Image \*image) }

\smallskip

\begin{description}

\item[\textit{status}]

Method WriteImage return True if the image is written.  False is returned is there is a memory shortage or if the image file fails to write.

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\item[\textit{image}]

A pointer to a Image structure.

\end{description}
\section{ImageMagick Image Methods}

\subsection{AllocateImage}

Method AllocateImage allocates an Image structure and initializes each field to a default value.


\smallskip

{\em Image \*AllocateImage (const ImageInfo \*image\_info) }

\smallskip

\begin{description}

\item[\textit{allocate\_image}]

Method AllocateImage returns a pointer to an image structure initialized to default values.  A null image is returned if there is a memory shortage.

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\end{description}

\subsection{AllocateImageColormap}

Method AllocateImageColormap allocates an Image colormap and initializes it.  The minimum number of colormap cells allocated is 256.


\smallskip

{\em unsigned int AllocateImageColormap (Image \*image, const unsigned int colors) }

\smallskip

\begin{description}

\item[\textit{status}]

Method AllocateImageColormap returns True if the colormap is successfully allocated and initialized, otherwise False.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{colors}]

The number of colors in the image colormap.

\end{description}

\subsection{AllocateNextImage}

Method AllocateNextImage allocates an Image structure and initializes each field to a default value.


\smallskip

{\em void AllocateNextImage (const ImageInfo \*image\_info, Image \*image) }

\smallskip

\begin{description}

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{AnimateImages}

Method AnimateImages displays one or more images to an X window.


\smallskip

{\em unsigned int AnimateImages (const ImageInfo \*image\_info, Image \*image) }

\smallskip

\begin{description}

\item[\textit{status}]

Method AnimateImages returns True if the images are displayed in an X window, otherwise False is returned.

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{AppendImages}

Method AppendImages appends a sequence of images.  All the input images must have the same width or height.  Images of the same width are stacked top-to-bottom.  Images of the same height are stacked left-to-right.  If stack is false, rectangular images are stacked left-to-right otherwise top-to-bottom.


\smallskip

{\em Image \*AppendImages (Image \*image, const unsigned int stack, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{stack}]

An unsigned value other than stacks rectangular image top-to-bottom otherwise left-to-right.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{AverageImages}

Method AverageImages averages a sequence of images.  All the input image must be the same size in pixels.


\smallskip

{\em Image \*AverageImages (const Image \*image, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{average\_image}]

Method AverageImages returns the mean pixel value for an image sequence.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{ChannelImage}

Method ChannelImage extracts the specified channel from the referenced image.


\smallskip

{\em unsigned int ChannelImage (Image \*image, const ChannelType channel) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{channel}]

A value of type ChannelType that identifies which channel to extract.

\end{description}

\subsection{CloneImage}

Method CloneImage clones an image.  If the specified columns and rows is 0, an exact copy of the image is returned, otherwise the pixel data is undefined and must be initialized with SetImagePixels() and SyncImagePixels() methods.


\smallskip

{\em Image \*CloneImage (Image \*image, const unsigned int columns, const unsigned int rows, const unsigned int orphan, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{clone\_image}]

Method CloneImage returns a pointer to the image after copying.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{columns}]

An integer that specifies the number of columns in the copied image.

\item[\textit{rows}]

An integer that specifies the number of rows in the copied image.

\item[\textit{orphan}]

if true, consider this image an orphan.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{CloneImageInfo}

Method CloneImageInfo makes a duplicate of the given image info, or if image info is NULL, a new one.


\smallskip

{\em ImageInfo \*CloneImageInfo (const ImageInfo \*image\_info) }

\smallskip

\begin{description}

\item[\textit{clone\_info}]

Method CloneImageInfo returns a duplicate of the given image info, or if image info is NULL a new one.

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\end{description}

\subsection{CompositeImage}

Method CompositeImage returns the second image composited onto the first at the specified offsets.


\smallskip

{\em unsigned int CompositeImage (Image \*image, const CompositeOperator compose, Image \*composite\_image, const int x\_offset, const int y\_offset) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{compose}]

Specifies an image composite operator.

\item[\textit{composite\_image}]

The address of a structure of type Image.

\item[\textit{x\_offset}]

An integer that specifies the column offset of the composited image.

\item[\textit{y\_offset}]

An integer that specifies the row offset of the composited image.

\end{description}

\subsection{CycleColormapImage}

Method CycleColormapImage cycles the image colormap by a specified amount.


\smallskip

{\em CycleColormapImage (image, amount) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{amount}]

An unsigned value that specifies the offset of the colormap.

\end{description}

\subsection{DescribeImage}

Method DescribeImage describes an image by printing its attributes to stdout.


\smallskip

{\em void DescribeImage (Image \*image, FILE \*file, const unsigned int verbose) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{file}]

send the image attributes to this file.

\item[\textit{verbose}]

an unsigned value other than zero prints detailed information about the image.

\end{description}

\subsection{DestroyImage}

Method DestroyImage deallocates memory associated with an image.


\smallskip

{\em void DestroyImage (Image \*image) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{DestroyImageInfo}

Method DestroyImageInfo deallocates memory associated with an ImageInfo structure.


\smallskip

{\em void DestroyImageInfo (ImageInfo \*image\_info) }

\smallskip

\begin{description}

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\end{description}

\subsection{DestroyImages}

Method DestroyImages deallocates memory associated with a linked list of images.


\smallskip

{\em void DestroyImages (Image \*image) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{DisplayImages}

Method DisplayImages displays one or more images to an X window.


\smallskip

{\em unsigned int DisplayImages (const ImageInfo \*image\_info, Image \*image) }

\smallskip

\begin{description}

\item[\textit{status}]

Method DisplayImages returns True if the images are displayed in an X window, otherwise False is returned.

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{GetImageBoundingBox}

Method GetImageBoundingBox returns the bounding box of an image canvas.


\smallskip

{\em RectangleInfo GetImageBoundingBox (Image \*image) }

\smallskip

\begin{description}

\item[\textit{bounds}]

Method GetImageBoundingBox returns the bounding box of an image canvas.

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{GetImageDepth}

Method GetImageDepth returns the depth of the image.


\smallskip

{\em unsigned int GetImageDepth (Image \*image) }

\smallskip

\begin{description}

\item[\textit{depth}]

Method GetImageDepth returns the depth of the image.

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{GetImageInfo}

Method GetImageInfo initializes the ImageInfo structure.


\smallskip

{\em void GetImageInfo (ImageInfo \*image\_info) }

\smallskip

\begin{description}

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\end{description}

\subsection{GetImageType}

Method GetImageType returns the type of image (e.g.  bilevel, palette, etc).


\smallskip

{\em ImageType GetImageType (Image \*image) }

\smallskip

\begin{description}

\item[\textit{type}]

Method GetImageType returns a ImageType enum that specifies the type of the specified image (e.g.  bilevel, palette, etc).

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{GetNextImage}

Method GetNextImage returns the next image in an image sequence.


\smallskip

{\em Image \*GetNextImage (Image \*image) }

\smallskip

\begin{description}

\item[\textit{next}]

Method GetNextImage returns the next image in an image sequence.

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{GetNumberScenes}

Method GetNumberScenes returns the number of scenes in an image sequence.


\smallskip

{\em unsigned int GetNumberScenes (const Image \*image) }

\smallskip

\begin{description}

\item[\textit{scenes}]

Method GetNumberScenes returns the number of scenes in an image sequence.

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{GetPageInfo}

Method GetPageInfo initializes the image page structure.


\smallskip

{\em void GetPageInfo (RectangleInfo \*page) }

\smallskip

\begin{description}

\item[\textit{page}]

Specifies a pointer to a RectangleInfo structure.

\end{description}

\subsection{GetPixelPacket}

Method GetPixelPacket initializes the PixelPacket structure.


\smallskip

{\em void GetPixelPacket (PixelPacket \*pixel) }

\smallskip

\begin{description}

\item[\textit{pixel}]

Specifies a pointer to a PixelPacket structure.

\end{description}

\subsection{IsGeometry}

Method IsGeometry returns True if the geometry specification is valid as determined by ParseGeometry.


\smallskip

{\em unsigned int IsGeometry (const char \*geometry) }

\smallskip

\begin{description}

\item[\textit{status}]

Method IsGeometry returns True if the geometry specification is valid otherwise False is returned.

\item[\textit{geometry}]

This string is the geometry specification.

\end{description}

\subsection{IsImagesEqual}

Method IsImagesEqual measures the difference between two images.  The error is computed by summing over all pixels in an image the distance squared in RGB space between each image pixel and its corresponding pixel in the reference image.  These values are computed:

\begin{description}

\item[\textit{mean\_error\_per\_pixel}]

This value is the mean error for any single pixel in the image.

\item[\textit{normalized\_mean\_square\_error}]

This value is the normalized mean quantization error for any single pixel in the image.  This distance measure is normalized to a range between 0 and 1.  It is independent of the range of red, green, and blue values in the image.

\item[\textit{normalized\_maximum\_square\_error}]

Thsi value is the normalized maximum quantization error for any single pixel in the image.  This distance measure is normalized to a range between 0 and 1.  It is independent of the range of red, green, and blue values in your image.

\end{description}


\smallskip

{\em unsigned int IsImagesEqual (Image \*image, Image \*reference) }


\begin{description}

\item[\textit{image}]

Specifies a pointer to an Image structure.

\item[\textit{reference}]

Specifies a pointer to an Image structure.

\end{description}

\subsection{IsTaintImage}

Method IsTaintImage returns True if the image has been altered since it was first read or if any image in the sequence has a difference magic or filename.


\smallskip

{\em unsigned int IsTaintImage (const Image \*image) }

\smallskip

\begin{description}

\item[\textit{status}]

Method IsTaintImage returns True if the image has been altered since it was first read.

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{IsSubimage}

Method IsSubimage returns True if the geometry is a valid subimage specification (e.g.  [1], [1-9], [1,7,4]).


\smallskip

{\em unsigned int IsSubimage (const char \*geometry, const unsigned int pedantic) }

\smallskip

\begin{description}

\item[\textit{status}]

Method IsSubimage returns True if the geometry is a valid subimage specification otherwise False is returned.

\item[\textit{geometry}]

This string is the geometry specification.

\item[\textit{pedantic}]

A value other than 0 invokes a more restriction set of conditions for a valid specification (e.g.  [1], [1-4], [4-1]).

\end{description}

\subsection{ListToGroupImage}

Method ListToGroupImage converts a linked list of images to a sequential array.


\smallskip

{\em Image \*\*ListToGroupImage (Image \*image, unsigned int \*number\_images) }

\smallskip

\begin{description}

\item[\textit{images}]

Method ListToGroupImage converts a linked list of images to a sequential array and returns the array..

\item[\textit{images}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{number\_images}]

A pointer to an unsigned integer.  The number of images in the image array is returned here.

\end{description}

\subsection{MogrifyImage}

Method MogrifyImage applies image processing options to an image as prescribed by command line options.


\smallskip

{\em unsigned int MogrifyImage (const ImageInfo \*image\_info, const int argc, char \*\*argv, Image \*\*image) }

\smallskip

\begin{description}

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\item[\textit{argc}]

Specifies a pointer to an integer describing the number of elements in the argument vector.

\item[\textit{argv}]

Specifies a pointer to a text array containing the command line arguments.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\end{description}

\subsection{MogrifyImages}

Method MogrifyImages applies next processing options to a sequence of images as prescribed by command line options.


\smallskip

{\em unsigned int MogrifyImages (const ImageInfo \*next\_info, const int argc, char \*\*argv, Image \*\*image) }

\smallskip

\begin{description}

\item[\textit{next\_info}]

Specifies a pointer to an ImageInfo structure.

\item[\textit{argc}]

Specifies a pointer to an integer describing the number of elements in the argument vector.

\item[\textit{argv}]

Specifies a pointer to a text array containing the command line arguments.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\end{description}

\subsection{MosaicImages}

Method MosaicImages inlays a number of image to form a single coherent picture.


\smallskip

{\em Image \*MosaicImages (const Image \*image, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{ParseImageGeometry}

Method ParseImageGeometry parses a geometry specification and returns the width, height, x, and y values.  It also returns flags that indicates which of the four values (width, height, xoffset, yoffset) were located in the string, and whether the x and y values are negative.  In addition,


\smallskip

{\em int ParseImageGeometry (const char \*geometry, int \*x, int \*y, unsigned int \*width, unsigned int \*height) }

\smallskip

\begin{description}

\item[\textit{flags}]

Method ParseImageGeometry returns a bitmask that indicates which of the four values were located in the geometry string.

\item[\textit{image\_geometry}]

Specifies a character string representing the geometry specification.

\item[\textit{x,y}]

A pointer to an integer.  The x and y offset as determined by the geometry specification is returned here.

\item[\textit{width,height}]

A pointer to an unsigned integer.  The width and height as determined by the geometry specification is returned here.

\end{description}

\subsection{RGBTransformImage}

Method RGBTransformImage converts the reference image from RGB to an alternate colorspace.  The transformation matrices are not the standard ones: the weights are rescaled to normalized the range of the transformed values to be [0..MaxRGB].


\smallskip

{\em unsigned int RGBTransformImage (Image \*image, const ColorspaceType colorspace) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{colorspace}]

An unsigned integer value that indicates which colorspace to transform the image.

\end{description}

\subsection{SetImage}

Method SetImage initializes the reference image to the background color.


\smallskip

{\em void SetImage (Image \*image, opacity) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{opacity}]

The transparency of the background color.

\end{description}

\subsection{SetImageDepth}

Method SetImageDepth sets the depth of the image.


\smallskip

{\em unsigned int SetImageDepth (Image \*image, const unsigned int) }

\smallskip

\begin{description}

\item[\textit{status}]

Method SetImageDepth returns True if the image depth is set.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{depth}]

specified the image depth.

\end{description}

\subsection{SetImageInfo}

Method SetImageInfo initializes the `magick' field of the ImageInfo structure.  It is set to a type of image format based on the prefix or suffix of the filename.  For example, `ps:image' returns PS indicating a Postscript image.  JPEG is returned for this filename: `image.jpg'. The filename prefix has precendence over the suffix.  Use an optional index enclosed in brackets after a file name to specify a desired subimage of a multi-resolution image format like Photo CD (e.g.  img0001.pcd[4]).


\smallskip

{\em unsigned int SetImageInfo (ImageInfo \*image\_info, const unsigned int rectify) }

\smallskip

\begin{description}

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\item[\textit{rectify}]

an unsigned value other than zero rectifies the attribute for multi-frame support (user may want multi-frame but image format may not support it).

\end{description}

\subsection{SetImageOpacity}

Method SetImageOpacity initializes the opacity channel of the reference image to the specified value.  If the image already has a matte channel it is attenuated with the opacity value.


\smallskip

{\em void SetImageOpacity (Image \*image, const unsigned int opacity) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{opacity}]

The level of transparency.

\end{description}

\subsection{SortColormapByIntentsity}

Method SortColormapByIntensity sorts the colormap of a PseudoClass image by decreasing color intensity.


\smallskip

    unsigned int SortColormapByIntensity(Image \*image)

\smallskip

\begin{description}

\item[\textit{image}]

A pointer to a Image structure.

\end{description}

\subsection{SyncImage}

Method SyncImage initializes the red, green, and blue intensities of each pixel as defined by the colormap index.


\smallskip

{\em void SyncImage (Image \*image) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{TextureImage}

Method TextureImage layers a texture onto the background of an image.


\smallskip

{\em void TextureImage (Image \*image, Image \*texture) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{texture}]

This image contains the texture to layer on the background.

\end{description}

\subsection{TransformRGBImage}

Method TransformRGBImage converts the reference image from an alternate colorspace.  The transformation matrices are not the standard ones: the weights are rescaled to normalize the range of the transformed values to be [0..MaxRGB].


\smallskip

{\em unsigned int TransformRGBImage (Image \*image, const ColorspaceType colorspace) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{colorspace}]

An unsigned integer value defines which colorspace to transform the image to.

\end{description}

\section{Methods to Resize an Image}

\subsection{MagnifyImage}

Method MagnifyImage creates a new image that is a integral size greater than an existing one.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


MagnifyImage scans the reference image to create a magnify image by bilinear interpolation.  The magnify image columns and rows become:

  number\_columns << 1
  number\_rows << 1

\smallskip

{\em magnify\_image=MagnifyImage (image, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{magnify\_image}]

Method MagnifyImage returns a pointer to the image after magnification.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{MinifyImage}

Method MinifyImage creates a new image that is a integral size less than an existing one.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


MinifyImage scans the reference image to create a minified image by computing the weighted average of a 4x4 cell centered at each reference pixel.  The target pixel requires two columns and two rows of the reference pixels.  Therefore the minified image columns and rows become:

  number\_columns/2
  number\_rows/2

Weights assume that the importance of neighboring pixels is negately proportional to the square of their distance from the target pixel.


The scan only processes pixels that have a full set of neighbors.  Pixels in the top, bottom, left, and right pairs of rows and columns are omitted from the scan.


\smallskip

{\em Image \*MinifyImage (Image \*image, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{minify\_image}]

Method MinifyImage returns a pointer to the image after reducing.  A null image is returned if there is a memory shortage or if the image size is less than IconSize\*2.

\item[\textit{image}]

The address of a structur of type Image.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{ResizeImage}

Method ResizeImage creates a new image that is a scaled size of an existing one.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.  The Point filter gives fast pixel replication, Triangle is equivalent to bi-linear interpolation, and Mitchel giver slower, very high-quality results.  See Graphic Gems III for details on this algorithm.


\smallskip

{\em Image \*ResizeImage (Image \*image, const unsigned int columns, const unsigned int rows, const FilterType filter, const double blur, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{resize\_image}]

Method ResizeImage returns a pointer to the image after scaling.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

the address of a structure of type Image.

\item[\textit{columns}]

an integer that specifies the number of columns in the resize image.

\item[\textit{rows}]

an integer that specifies the number of rows in the scaled image.

\item[\textit{filter}]

specifies which image filter to use.

\item[\textit{blur}]

specifies the blur factor where > 1 is blurry, < 1 is sharp.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{SampleImage}

Method SampleImage creates a new image that is a scaled size of an existing one using pixel sampling.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*SampleImage (Image \*image, const unsigned int columns, const unsigned int rows, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{sample\_image}]

Method SampleImage returns a pointer to the image after scaling.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{columns}]

An integer that specifies the number of columns in the sampled image.

\item[\textit{rows}]

An integer that specifies the number of rows in the sampled image.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{ScaleImage}

Method ScaleImage creates a new image that is a scaled size of an existing one.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.  To scale a scanline from x pixels to y pixels, each new pixel represents x/y old pixels.  To read x/y pixels, read (x/y rounded up) pixels but only count the required fraction of the last old pixel read in your new pixel.  The remainder of the old pixel will be counted in the next new pixel.


The scaling algorithm was suggested by rjohnson@shell.com and is adapted from pnmscale(1) of PBMPLUS by Jef Poskanzer.


\smallskip

{\em Image \*ScaleImage (Image \*image, const unsigned int columns, const unsigned int rows, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{scale\_image}]

Method ScaleImage returns a pointer to the image after scaling.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{columns}]

An integer that specifies the number of columns in the scaled image.

\item[\textit{rows}]

An integer that specifies the number of rows in the scaled image.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{ZoomImage}

Method ZoomImage creates a new image that is a scaled size of an existing one.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.  The Point filter gives fast pixel replication, Triangle is equivalent to bi-linear interpolation, and Mitchel giver slower, very high-quality results.  See Graphic Gems III for details on this algorithm.


The filter member of the Image structure specifies which image filter to use.  Blur specifies the blur factor where > 1 is blurry, < 1 is sharp.


\smallskip

{\em Image \*ZoomImage (Image \*image, const unsigned int columns, const unsigned int rows, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{zoom\_image}]

Method ZoomImage returns a pointer to the image after scaling.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{columns}]

An integer that specifies the number of columns in the zoom image.

\item[\textit{rows}]

An integer that specifies the number of rows in the scaled image.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}
\section{Methods to Transform an Image}

\subsection{ChopImage}

Method ChopImage creates a new image that is a subregion of an existing one.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*ChopImage (Image \*image, const RectangleInfo \*chop\_info) }
      ExceptionInfo \*exception)

\smallskip

\begin{description}

\item[\textit{chop\_image}]

Method ChopImage returns a pointer to the chop image.  A null image is returned if there is a memory shortage or if the image width or height is zero.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{chop\_info}]

Specifies a pointer to a RectangleInfo which defines the region of the image to crop.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{CoalesceImages}

Method CoalesceImages merges a sequence of images.  This is useful for GIF and MNG animation sequences that have page offsets and disposal methods.


\smallskip

{\em Image \*CoalesceImages (Image \*image, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.  It points to the first image in the group to be coalesced.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{CropImage}

Method CropImage creates a new image that is a subregion of an existing one.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.  This method is optimized to preserve the runlength encoding.  That is, the crop image will always use less memory than the original.


\smallskip

{\em Image \*CropImage (Image \*image, const RectangleInfo \*crop\_info, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{crop\_image}]

Method CropImage returns a pointer to the crop image.  A null image is returned if there is a memory shortage or if the image width or height is zero.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{crop\_info}]

Specifies a pointer to a RectangleInfo which defines the region of the image to crop.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{DeconstructImages}

Method DeconstructImages breaks down an image sequence into constituent parts.  This is useful for creating GIF or MNG animation sequences.


\smallskip

{\em Image \*DeconstructImages (Image \*image, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.  It points to the first next in the group to be deconstructed.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{FlipImage}

Method FlipImage creates a new image that reflects each scanline in the vertical direction It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*FlipImage (Image \*image, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{flip\_image}]

Method FlipImage returns a pointer to the image after reflecting.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{FlopImage}

Method FlopImage creates a new image that reflects each scanline in the horizontal direction It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*FlopImage (Image \*image, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{flop\_image}]

Method FlopImage returns a pointer to the image after reflecting.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{ProfileImage}

Method ProfileImage removes or adds a ICM, IPTC, or generic profile to an image.  If the profile name is specified it is deleted from the image.  If a filename is specified, one or more profiles are read and added to the image.


\smallskip

{\em unsigned int ProfileImage (Image \*image, const char \*profile\_name, const char \*filename) }

\smallskip

\begin{description}

\item[\textit{status}]

Method ProfileImage returns True if the profile is successfully added or removed from the image, otherwise False.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{profile\_name}]

Specifies the type of profile to add or remove.

\item[\textit{filename}]

Specifies the filename of the ICM or IPTC profile.

\end{description}

\subsection{RollImage}

Method RollImage rolls an image vertically and horizontally.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*RollImage (Image \*image, const int x\_offset, const int y\_offset, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{roll\_image}]

Method RollImage returns a pointer to the image after rolling.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{x\_offset}]

An integer that specifies the number of columns to roll in the horizontal direction.

\item[\textit{y\_offset}]

An integer that specifies the number of rows to roll in the vertical direction.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{TransformImage}

Method TransformImage creates a new image that is a transformed size of of existing one as specified by the crop and image geometries.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


If a crop geometry is specified a subregion of the image is obtained.  If the specified image size, as defined by the image and scale geometries, is smaller than the actual image size, the image is first minified to an integral of the specified image size with an antialias digital filter.  The image is then scaled to the exact specified image size with pixel replication.  If the specified image size is greater than the actual image size, the image is first enlarged to an integral of the specified image size with bilinear interpolation.  The image is then scaled to the exact specified image size with pixel replication.


\smallskip

{\em void TransformImage (Image \*\*image, const char \*crop\_geometry, const char \*image\_geometry) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of an address of a structure of type Image.  The transformed image is returned as this parameter.

\item[\textit{crop\_geometry}]

Specifies a pointer to a crop geometry string.  This geometry defines a subregion of the image.

\item[\textit{image\_geometry}]

Specifies a pointer to a image geometry string.  The specified width and height of this geometry string are absolute.

\end{description}
\section{Methods to Draw on an Image}

\subsection{CloneDrawInfo}

Method CloneDrawInfo makes a duplicate of the given draw info, or if draw info is NULL, a new one.


\smallskip

{\em DrawInfo \*CloneDrawInfo (const ImageInfo \*image\_info, const DrawInfo \*draw\_info) }

\smallskip

\begin{description}

\item[\textit{clone\_info}]

Method CloneDrawInfo returns a duplicate of the given annotate info, or if annotate info is NULL a new one.

\item[\textit{image\_info}]

a structure of type ImageInfo.

\item[\textit{draw\_info}]

a structure of type DrawInfo.

\end{description}

\subsection{ColorFloodfillImage}

Method ColorFloodfillImage floodfills the designated area with a color.  The floodfill algorithm is strongly based on a similar algorithm in "Graphics Gems" by Paul Heckbert.


\smallskip

{\em unsigned int ColorFloodfillImage (Image \*image, const DrawInfo \*draw\_info, const PixelPacket target, const int x\_offset, const int y\_offset, const PaintMethod method) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{draw\_info}]

a structure of type DrawInfo.

\item[\textit{target}]

A PixelPacket structure.  This is the RGB value of the target color.

\item[\textit{x,y}]

Unsigned integers representing the current location of the pen.

\item[\textit{method}]

drawing method of type PrimitiveType: floodfill or fill to border.

\end{description}

\subsection{DestroyDrawInfo}

Method DestroyDrawInfo deallocates memory associated with an DrawInfo structure.


\smallskip

{\em void DestroyDrawInfo (DrawInfo \*draw\_info) }

\smallskip

\begin{description}

\item[\textit{draw\_info}]

Specifies a pointer to an DrawInfo structure.

\end{description}

\subsection{DrawImage}

Method DrawImage draws a primitive (line, rectangle, ellipse) on the image.


\smallskip

{\em unsigned int DrawImage (Image \*image, const DrawInfo \*draw\_info) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{draw\_info}]

The address of a DrawInfo structure.

\end{description}

\subsection{GetDrawInfo}

Method GetDrawInfo initializes the DrawInfo structure.


\smallskip

{\em void GetDrawInfo (const ImageInfo \*image\_info, DrawInfo \*draw\_info) }

\smallskip

\begin{description}

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\item[\textit{draw\_info}]

Specifies a pointer to a DrawInfo structure.

\end{description}

\subsection{MatteFloodfillImage}

Method MatteFloodfillImage floodfills the designated area with a matte value.  The floodfill algorithm is strongly based on a similar algorithm in "Graphics Gems" by Paul Heckbert.


\smallskip

{\em unsigned int MatteFloodfillImage (Image \*image, const PixelPacket target, const unsigned int matte, const int x\_offset, const int y\_offset, const PaintMethod method) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{target}]

A PixelPacket structure.  This is the RGB value of the target color.

\item[\textit{matte}]

A integer value representing the amount of transparency.

\item[\textit{x,y}]

Unsigned integers representing the current location of the pen.

\item[\textit{method}]

drawing method of type PrimitiveType: floodfill or fill to border.

\end{description}

\subsection{OpaqueImage}

Method OpaqueImage changes the color of an opaque point to the pen color.


\smallskip

{\em unsigned int OpaqueImage (Image \*image, const PixelPacket target, const PixelPacket pen\_color) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{target}]

the color to search for in the image.

\item[\textit{pen\_color}]

the color to replace it with.

\end{description}

\subsection{TransparentImage}

Method TransparentImage creates a matte image associated with the image.  All pixel locations are initially set to opaque.  Any pixel that matches the specified color are set to transparent.


\smallskip

{\em unsigned int TransparentImage (Image \*image, const PixelPacket target) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{target}]

The color to search for in the image.

\end{description}
\section{Methods to Annotate an Image}

\subsection{AnnotateImage}

Method AnnotateImage annotates an image with text.  Optionally the annotation can include the image filename, type, width, height, or scene


\smallskip

{\em unsigned int AnnotateImage (Image \*image, DrawInfo \*draw\_info) }

\smallskip

\begin{description}

\item[\textit{status}]

Method AnnotateImage returns True if the image is annotated otherwise False.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{draw\_info}]

The address of a DrawInfo structure.

\end{description}

\subsection{GetTypeMetrics}

Method GetTypeMetrics returns the following information for the specified font and text:

\begin{description}

\item[\textit{o}]

character width, expressed in integer pixels o character height, expressed in integer pixels o ascent, expressed in 26.6 fixed point pixels o descent, expressed in 26.6 fixed point pixels o text width, expressed in 26.6 fixed point pixels o text height, expressed in 26.6 fixed point pixels o maximum horizontal advance, expressed in 26.6 fixed point pixels

\end{description}


\smallskip

{\em unsigned int GetTypeMetrics (Image \*image, const DrawInfo \*draw\_info, FontMetric metrics) }

\smallskip

\begin{description}

\item[\textit{status}]

Method GetTypeMetrics returns True if the metrics are available otherwise False.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{draw\_info}]

Specifies a pointer to a DrawInfo structure.

\item[\textit{metrics}]

Method GetTypeMetrics returns the font metrics.

\end{description}
\section{Methods to Count the Colors in an Image}

\subsection{CompressColormap}

Method CompressColormap compresses an image colormap removing any duplicate and unused color entries.


\smallskip

{\em void CompressColormap (Image \*image) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{GetNumberColors}

Method GetNumberColors returns the number of unique colors in an image.


\smallskip

{\em number\_colors=GetNumberColors (image, file) }


\begin{description}

\item[\textit{number\_colors}]

Method GetNumberColors returns the number of unique colors in the specified image.

\item[\textit{image}]

The address of a byte (8 bits) array of run-length encoded pixel data of your source image.  The sum of the run-length counts in the source image must be equal to or exceed the number of pixels.

\item[\textit{file}]

An pointer to a FILE.  If it is non-null a list of unique pixel field values and the number of times each occurs in the image is written to the file.

\end{description}

\subsection{IsGrayImage}

Method IsGrayImage returns True if the image is grayscale otherwise False is returned.  If the image is DirectClass and grayscale, it is demoted to PseudoClass.


\smallskip

{\em unsigned int IsGrayImage (Image \*image) }

\smallskip

\begin{description}

\item[\textit{status}]

Method IsGrayImage returns True if the image is grayscale otherwise False is returned.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\end{description}

\subsection{IsMonochromeImage}

Method IsMonochromeImage returns True if the image is monochrome otherwise False is returned.  If the image is DirectClass and grayscale (including monochrome), it is demoted to PseudoClass.


\smallskip

{\em status=IsMonochromeImage (image) }

\smallskip

\begin{description}

\item[\textit{status}]

Method IsMonochromeImage returns True if the image is monochrome otherwise False is returned.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\end{description}

\subsection{IsOpaqueImage}

Method IsOpaqueImage returns False if the image has one or more pixels that are transparent otherwise True is returned.


\smallskip

{\em unsigned int IsOpaqueImage (Image \*image) }

\smallskip

\begin{description}

\item[\textit{status}]

Method IsOpaqueImage returns False if the image has one or more pixels that are transparent otherwise True is returned.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\end{description}

\subsection{IsPseudoClass}

Method IsPseudoClass returns True if the image is PseudoClass and has 256 unique colors or less.  If the image is DirectClass and has 256 colors or less, the image is demoted to PseudoClass.


\smallskip

{\em unsigned int IsPseudoClass (Image \*image) }


\begin{description}

\item[\textit{status}]

Method IsPseudoClass returns True is the image is PseudoClass or has 256 color or less.

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{ListColors}

Method ListColors reads the X client color database and returns a list of colors contained in the database sorted in ascending alphabetic order.


\smallskip

{\em filelist=ListColors (pattern, number\_colors) }

\smallskip

\begin{description}

\item[\textit{filelist}]

Method ListColors returns a list of colors contained in the database.  If the database cannot be read, a NULL list is returned.

\item[\textit{pattern}]

Specifies a pointer to a text string containing a pattern.

\item[\textit{number\_colors}]

This integer returns the number of colors in the list.

\end{description}

\subsection{QueryColorDatabase}

Method QueryColorDatabase looks up a RGB values for a color given in the target string.


\smallskip

{\em unsigned int QueryColorDatabase (const char \*target, PixelPacket \*color) }

\smallskip

\begin{description}

\item[\textit{status}]

Method QueryColorDatabase returns True if the RGB values of the target color is defined, otherwise False is returned.

\item[\textit{target}]

Specifies the color to lookup in the X color database.

\item[\textit{color}]

A pointer to an PixelPacket structure.  The RGB value of the target color is returned as this value.

\end{description}

\subsection{QueryColorName}

Method QueryColorName returns the name of the color that is closest to the supplied color in RGB space.


\smallskip

{\em unsigned int QueryColorName (const PixelPacket \*color, char \*name) }


\begin{description}

\item[\textit{distance}]

Method QueryColorName returns the distance-squared in RGB space as well as the color name that is at a minimum distance.

\item[\textit{color}]

This is a pointer to a PixelPacket structure that contains the color we are searching for.

\item[\textit{name}]

The name of the color that is closest to the supplied color is returned in this character buffer.

\end{description}
\section{ImageMagick Image Decoration Methods}

\subsection{BorderImage}

Method BorderImage takes an image and puts a border around it of a particular color.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*BorderImage (const Image \*image, const RectangleInfo \*border\_info, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{border\_image}]

Method BorderImage returns a pointer to the border image.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{border\_info}]

Specifies a pointer to a structure of type Rectangle which defines the border region.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{FrameImage}

Method FrameImage takes an image and puts a frame around it of a particular color.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*FrameImage (Image \*image, const FrameInfo \*frame\_info, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{frame\_image}]

Method FrameImage returns a pointer to the framed image.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{frame\_info}]

Specifies a pointer to a FrameInfo structure which defines the framed region.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{RaiseImage}

Method RaiseImage lightens and darkens the edges of an image to give a 3-D raised or lower effect.


\smallskip

{\em unsigned int RaiseImage (Image \*image, const RectangleInfo \*raise\_info, const int raised) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{raise\_info}]

Specifies a pointer to a XRectangle which defines the raised region.

\item[\textit{raised}]

A value other than zero causes the image to have a 3-D raised effect, otherwise it has a lowered effect.

\end{description}
\section{Methods to Create a Montage.}

\subsection{CloneMontageInfo}

Method CloneMontageInfo makes a duplicate of the given montage info, or if montage info is NULL, a new one.


\smallskip

{\em MontageInfo \*CloneMontageInfo (const ImageInfo \*image\_info, const MontageInfo \*montage\_info) }

\smallskip

\begin{description}

\item[\textit{clone\_info}]

Method CloneMontageInfo returns a duplicate of the given annotate info, or if annotate info is NULL a new one.

\item[\textit{image\_info}]

a structure of type ImageInfo.

\item[\textit{montage\_info}]

a structure of type MontageInfo.

\end{description}

\subsection{DestroyMontageInfo}

Method DestroyMontageInfo deallocates memory associated with an MontageInfo structure.


\smallskip

{\em void DestroyMontageInfo (MontageInfo \*montage\_info) }

\smallskip

\begin{description}

\item[\textit{montage\_info}]

Specifies a pointer to an MontageInfo structure.

\end{description}

\subsection{GetMontageInfo}

Method GetMontageInfo initializes the MontageInfo structure.


\smallskip

{\em void GetMontageInfo (const ImageInfo \*image\_info, MontageInfo \*montage\_info) }

\smallskip

\begin{description}

\item[\textit{image\_info}]

a structure of type ImageInfo.

\item[\textit{montage\_info}]

Specifies a pointer to a MontageInfo structure.

\end{description}

\subsection{MontageImages}

Method MontageImages creates a composite image by combining several separate images.


\smallskip

{\em Image \*MontageImages (Image \*image, const MontageInfo \*montage\_info, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{image}]

Specifies a pointer to an array of Image structures.

\item[\textit{montage\_info}]

Specifies a pointer to a MontageInfo structure.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}
\section{ImageMagick Image Effects Methods}

\subsection{AddNoiseImage}

Method AddNoiseImage creates a new image that is a copy of an existing one with noise added.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*AddNoiseImage (Image \*image, const NoiseType noise\_type, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{noise\_image}]

Method AddNoiseImage returns a pointer to the image after the noise is minified.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{noise\_type}]

The type of noise: Gaussian, multiplicative Gaussian, impulse, laplacian, or Poisson.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{BlurImage}

Method BlurImage creates a blurred copy of the input image.  We convolve the image with a Gaussian operator of the given width and standard deviation (sigma).


Each output pixel is set to a value that is the weighted average of the input pixels in an area enclosing the pixel.  The width parameter determines how large the area is.  Each pixel in the area is weighted in the average according to its distance from the center, and the standard deviation, sigma.  The actual weight is calculated according to the Gaussian distribution (also called normal distribution), which looks like a Bell Curve centered on a pixel.  The standard deviation controls how 'pointy' the curve is.  The pixels near the center of the curve (closer to the center of the area we are averaging) contribute more than the distant pixels.


In general, the width should be wide enough to include most of the total weight under the Gaussian for the standard deviation you choose.  the width parameter to the function specifies the radius of the Gaussian convolution mask in pixels, not counting the centre pixel, the width parameter should be chosen larger than the standard deviation, perhaps about twice as large to three times as large.  A width of 1 will give a (standard) 3x3 convolution mask, a width of 2 gives a 5 by 5 convolution mask.  Using non-integral widths will result in some pixels being considered 'partial' pixels, in which case their weight will be reduced proportionally.


Pixels for which the convolution mask does not completely fit on the image (e.g.  pixels without a full set of neighbours) are averaged with those neighbours they do have.  Thus pixels at the edge of images are typically less blur.


Since a 2d Gaussian is seperable, we perform the Gaussian blur by convolving with two 1d Gaussians, first in the x, then in the y direction.  For an n by n image and Gaussian width w this requires $2^2$ multiplications, while convolving with a 2d Gaussian requres $w^2n^2$ mults.


We blur the image into a copy, and the original is left untouched.  We must process the image in two passes, in each pass we change the pixel based on its neighbors, but we need the pixel's original value for the next pixel's calculation.  For the first pass we could use the original image but that's no good for the second pass, and it would imply that the original image have to stay around in ram.  Instead we use a small (size=width) buffer to store the pixels we have overwritten.


This method was contributed by runger@cs.mcgill.ca.


\smallskip

{\em Image \*BlurImage (Image \*image, const double radius, const double sigma, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{blur\_image}]

Method BlurImage returns a pointer to the image after it is blur.  A null image is returned if there is a memory shortage.

\item[\textit{radius}]

The radius of the Gaussian, in pixels, not counting the center pixel.

\item[\textit{sigma}]

The standard deviation of the Gaussian, in pixels.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{ColorizeImage}

Method ColorizeImage creates a new image that is a copy of an existing one with the image pixels colorized.  The colorization is controlled with the pen color and the opacity levels.


\smallskip

{\em Image \*ColorizeImage (Image \*image, const char \*opacity, const PixelPacket target, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{opacity}]

A character string indicating the level of opacity as a percentage (0-0.5).

\item[\textit{target}]

A color value.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{ConvolveImage}

Method ConvolveImage applies a general image convolution kernel to an image returns the results.  ConvolveImage allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*ConvolveImage (Image \*image, const unsigned int order, const double \*kernel, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{convolve\_image}]

Method ConvolveImage returns a pointer to the image after it is convolved.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{order}]

The number of columns and rows in the filter kernel.

\item[\textit{kernel}]

An array of double representing the convolution kernel.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{DespeckleImage}

Method DespeckleImage creates a new image that is a copy of an existing one with the speckle noise minified.  It uses the eight hull algorithm described in Applied Optics, Vol.  24, No.  10, 15 May 1985, "Geometric filter for Speckle Reduction", by Thomas R Crimmins.  Each pixel in the image is replaced by one of its eight of its surrounding pixels using a polarity and negative hull function.  DespeckleImage allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*DespeckleImage (Image \*image, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{despeckle\_image}]

Method DespeckleImage returns a pointer to the image after it is despeckled.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{EdgeImage}

Method EdgeImage creates a new image that is a copy of an existing one with the edges enhanced.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*EdgeImage (Image \*image, const double radius, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{edge\_image}]

Method EdgeImage returns a pointer to the image after it is edge.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

the address of a structure of type Image returned from ReadImage.

\item[\textit{radius}]

the radius of the pixel neighborhood.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{EmbossImage}

Method EmbossImage creates a new image that is a copy of an existing one with the edge highlighted.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*EmbossImage (Image \*image, const double radius, const double sigma, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{emboss\_image}]

Method EmbossImage returns a pointer to the image after it is embossed.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{radius}]

the radius of the pixel neighborhood.

\item[\textit{sigma}]

The standard deviation of the Gaussian, in pixels.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{EnhanceImage}

Method EnhanceImage creates a new image that is a copy of an existing one with the noise minified.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


EnhanceImage does a weighted average of pixels in a 5x5 cell around each target pixel.  Only pixels in the 5x5 cell that are within a RGB distance threshold of the target pixel are averaged.


Weights assume that the importance of neighboring pixels is negately proportional to the square of their distance from the target pixel.


The scan only processes pixels that have a full set of neighbors.  Pixels in the top, bottom, left, and right pairs of rows and columns are omitted from the scan.


\smallskip

{\em Image \*EnhanceImage (Image \*image, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{enhance\_image}]

Method EnhanceImage returns a pointer to the image after it is enhanced.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{GaussianBlurImage}

Method GaussianBlurImage creates a new image that is a copy of an existing one with the pixels blur.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*GaussianBlurImage (Image \*image, const double radius, const double sigma, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{blur\_image}]

Method GaussianBlurImage returns a pointer to the image after it is blur.  A null image is returned if there is a memory shortage.

\item[\textit{radius}]

the radius of the Gaussian, in pixels, not counting the center pixel.

\item[\textit{sigma}]

the standard deviation of the Gaussian, in pixels.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{ImplodeImage}

Method ImplodeImage creates a new image that is a copy of an existing one with the image pixels "implode" by the specified percentage.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*ImplodeImage (Image \*image, const double factor, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{implode\_image}]

Method ImplodeImage returns a pointer to the image after it is implode.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{factor}]

A double value that defines the extent of the implosion.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{MedianFilterImage}

Method MedianFilterImage creates a new image that is a copy of an existing one with each pixel component replaced with the median color in a pixel neighborhood.


\smallskip

{\em Image \*MedianFilterImage (Image \*image, const double radius, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{median\_image}]

Method MedianFilterImage returns a pointer to the image after it is `filtered'. A null image is returned if there is a memory shortage.

\item[\textit{image}]

the address of a structure of type Image returned from ReadImage.

\item[\textit{radius}]

the radius of the pixel neighborhood.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{MorphImages}

Method MorphImages morphs a sequence of images.  Both the next pixels and size are linearly interpolated to give the appearance of a meta-morphosis from one next to the next.


\smallskip

{\em Image \*MorphImages (Image \*image, const unsigned int number\_frames, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{morph\_images}]

Method MorphImages returns an next sequence that has linearly interpolated pixels and size between two input image.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{number\_frames}]

This unsigned integer reflects the number of in-between image to generate.  The more in-between frames, the smoother the morph.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{OilPaintImage}

Method OilPaintImage creates a new image that is a copy of an existing one with each pixel component replaced with the color of greatest frequency in a circular neighborhood.


\smallskip

{\em Image \*OilPaintImage (Image \*image, const double radius, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{paint\_image}]

Method OilPaintImage returns a pointer to the image after it is `painted'. A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{radius}]

The radius of the circular neighborhood.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{PlasmaImage}

Method PlasmaImage initializes an image with plasma fractal values.  The image must be initialized with a base color and the random number generator seeded before this method is called.


\smallskip

{\em unsigned int PlasmaImage (Image \*image, const SegmentInfo \*segment, int attenuate, int depth) }

\smallskip

\begin{description}

\item[\textit{status}]

Method PlasmaImage returns True when the fractal process is complete.  Otherwise False is returned.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{segment}]

specifies a structure of type SegmentInfo that defines the boundaries of the area where the plasma fractals are applied.

\item[\textit{attenuate}]

specifies the plasma attenuation factor.

\item[\textit{depth}]

this integer values define the plasma recursion depth.

\end{description}

\subsection{ReduceNoiseImage}

Method ReduceNoiseImage creates a new image that is a copy of an existing one with the noise minified with a noise peak elimination filter.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


The principal function of noise peak elimination filter is to smooth the objects within an image without losing edge information and without creating undesired structures.  The central idea of the algorithm is to replace a pixel with its next neighbor in value within a window, if this pixel has been found to be noise.  A pixel is defined as noise if and only if this pixel is a maximum or minimum within the window.


\smallskip

{\em Image \*ReduceNoiseImage (Image \*image, const double, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{noise\_image}]

Method ReduceNoiseImage returns a pointer to the image after the noise is minified.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

the address of a structure of type Image returned from ReadImage.

\item[\textit{radius}]

the radius of the pixel neighborhood.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{ShadeImage}

Method ShadeImage creates a new image that is a copy of an existing one with the image pixels shaded using a distance light source.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*ShadeImage (Image \*image, const unsigned int color\_shading, double azimuth, double elevation, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{shade\_image}]

Method ShadeImage returns a pointer to the image after it is shaded.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{color\_shading}]

A value other than zero shades the red, green, and blue components of the image.

\item[\textit{azimuth, elevation}]

A double value that indicates the light source direction.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{SharpenImage}

Method SharpenImage creates a new image that is sharpened version of the original image using a Laplacian convolution kernel.


\smallskip

{\em Image \*SharpenImage (Image \*image, const double radius, const double sigma, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{sharp\_image}]

Method SharpenImage returns a pointer to the image after it is sharp.  A null image is returned if there is a memory shortage.

\item[\textit{radius}]

The radius of the Gaussian, in pixels, not counting the center pixel.

\item[\textit{sigma}]

The standard deviation of the Laplacian, in pixels.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{SolarizeImage}

Method SolarizeImage produces a 'solarization' effect seen when exposing a photographic film to light during the development process.


\smallskip

{\em void SolarizeImage (Image \*image, const double factor) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{factor}]

An double value that defines the extent of the solarization.

\end{description}

\subsection{SpreadImage}

Method SpreadImage creates a new image that is a copy of an existing one with the image pixels randomly displaced.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*SpreadImage (Image \*image, const unsigned int amount, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{spread\_image}]

Method SpreadImage returns a pointer to the image after it is spread.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{amount}]

An unsigned value constraining the "vicinity" for choosing a random pixel to swap.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{SteganoImage}

Method SteganoImage hides a digital watermark within the image.


\smallskip

{\em Image \*SteganoImage (Image \*image, Image \*watermark, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{stegano\_image}]

Method SteganoImage returns a pointer to the steganographic image with the watermark hidden.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{watermark}]

The address of a structure of type Image.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{StereoImage}

Method StereoImage combines two images and produces a single image that is the composite of a left and right image of a stereo pair.  The left image is converted to gray scale and written to the red channel of the stereo image.  The right image is converted to gray scale and written to the blue channel of the stereo image.  View the composite image with red-blue glasses to create a stereo effect.


\smallskip

{\em Image \*StereoImage (Image \*image, Image \*offset\_image, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{stereo\_image}]

Method StereoImage returns a pointer to the stereo image.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{offset\_image}]

The address of a structure of type Image.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{SwirlImage}

Method SwirlImage creates a new image that is a copy of an existing one with the image pixels "swirl" at a specified angle.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*SwirlImage (Image \*image, double degrees, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{swirl\_image}]

Method SwirlImage returns a pointer to the image after it is swirl.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{degrees}]

An double value that defines the tightness of the swirling.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{ThresholdImage}

Method ThresholdImage thresholds the reference image.


\smallskip

{\em unsigned int ThresholdImage (Image \*image, const double threshold) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{threshold}]

A double indicating the threshold value.

\end{description}

\subsection{UnsharpMaskImage}

Method UnsharpMaskImage creates a new image that is sharpened version of the original image using the unsharp mask algorithm.


\smallskip

{\em Image \*UnsharpMaskImage (Image \*image, const double radius, const double sigma, const double amount, const double threshold, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{unsharp\_image}]

Method UnsharpMaskImage returns a pointer to the image after it is blur.  A null image is returned if there is a memory shortage.

\item[\textit{radius}]

The radius of the Gaussian, in pixels, not counting the center pixel.

\item[\textit{sigma}]

The standard deviation of the Gaussian, in pixels.

\item[\textit{amount}]

The percentage of the difference between the original and the blur image that is added back into the original.

\item[\textit{threshold}]

The threshold in pixels needed to apply the diffence amount.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{WaveImage}

Method WaveImage creates a new image that is a copy of an existing one with the image pixels altered along a sine wave.  It allocates the memory necessary for the new Image structure and returns a pointer to the new image.


\smallskip

{\em Image \*WaveImage (Image \*image, const double amplitude, const double wave\_length, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{wave\_image}]

Method WaveImage returns a pointer to the image after it is waved.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{amplitude, frequency}]

A double value that indicates the amplitude and wave\_length of the sine wave.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}
\section{Methods to Enhance an Image}

\subsection{ContrastImage}

Method ContrastImage enhances the intensity differences between the lighter and darker elements of the image.


\smallskip

{\em unsigned int ContrastImage (Image \*image, const unsigned int sharpen) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{sharpen}]

If True, the intensity is increased otherwise it is decreased.

\end{description}

\subsection{EqualizeImage}

Method EqualizeImage performs histogram equalization on the reference image.


\smallskip

{\em unsigned int EqualizeImage (Image \*image) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\end{description}

\subsection{GammaImage}

Method GammaImage converts the reference image to gamma corrected colors.


\smallskip

{\em unsigned int GammaImage (Image \*image, const char \*gamma) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{gamma}]

A character string indicating the level of gamma correction.

\end{description}

\subsection{ModulateImage}

Method ModulateImage modulates the hue, saturation, and brightness of an image.


\smallskip

{\em unsigned int ModulateImage (Image \*image, const char \*modulate) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{modulate}]

A character string indicating the percent change in brightness, saturation, and hue in floating point notation separated by commas (e.g.  110.1,100.0,83.1).

\end{description}

\subsection{NegateImage}

Method NegateImage negates the colors in the reference image.  The Grayscale option means that only grayscale values within the image are negated.


\smallskip

{\em unsigned int NegateImage (Image \*image, const unsigned int grayscale) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\end{description}

\subsection{NormalizeImage}

Method NormalizeImage normalizes the pixel values to span the full range of color values.  This is a contrast enhancement technique.


\smallskip

{\em unsigned int NormalizeImage (Image \*image) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\end{description}
\section{Methods to Reduce the Number of Unique Colors in an Image}

\subsection{CloneQuantizeInfo}

Method CloneQuantizeInfo makes a duplicate of the given quantize info structure, or if quantize info is NULL, a new one.


\smallskip

{\em QuantizeInfo \*CloneQuantizeInfo (const QuantizeInfo \*quantize\_info) }

\smallskip

\begin{description}

\item[\textit{clone\_info}]

Method CloneQuantizeInfo returns a duplicate of the given quantize info, or if image info is NULL a new one.

\item[\textit{quantize\_info}]

a structure of type info.

\end{description}

\subsection{DestroyQuantizeInfo}

Method DestroyQuantizeInfo deallocates memory associated with an QuantizeInfo structure.


\smallskip

{\em DestroyQuantizeInfo (QuantizeInfo \*quantize\_info) }

\smallskip

\begin{description}

\item[\textit{quantize\_info}]

Specifies a pointer to an QuantizeInfo structure.

\end{description}

\subsection{GetQuantizeInfo}

Method GetQuantizeInfo initializes the QuantizeInfo structure.


\smallskip

{\em GetQuantizeInfo (QuantizeInfo \*quantize\_info) }

\smallskip

\begin{description}

\item[\textit{quantize\_info}]

Specifies a pointer to a QuantizeInfo structure.

\end{description}

\subsection{MapImage}

MapImage replaces the colors of an image with the closest color from a reference image.


\smallskip

{\em unsigned int MapImage (Image \*image, Image \*map\_image, const unsigned int dither) }

\smallskip

\begin{description}

\item[\textit{image}]

Specifies a pointer to an Image structure.

\item[\textit{map\_image}]

Specifies a pointer to a Image structure.  Reduce image to a set of colors represented by this image.

\item[\textit{dither}]

Set this integer value to something other than zero to dither the quantized image.

\end{description}

\subsection{MapImages}

MapImages replaces the colors of a sequence of images with the closest color from a reference image.


\smallskip

{\em unsigned int MapImages (Image \*images, Image \*map\_image, const unsigned int dither) }

\smallskip

\begin{description}

\item[\textit{image}]

Specifies a pointer to a set of Image structures.

\item[\textit{map\_image}]

Specifies a pointer to a Image structure.  Reduce image to a set of colors represented by this image.

\item[\textit{dither}]

Set this integer value to something other than zero to dither the quantized image.

\end{description}

\subsection{QuantizationError}

Method QuantizationError measures the difference between the original and quantized images.  This difference is the total quantization error.  The error is computed by summing over all pixels in an image the distance squared in RGB space between each reference pixel value and its quantized value.  These values are computed:

\begin{description}

\item[\textit{mean\_error\_per\_pixel}]

This value is the mean error for any single pixel in the image.

\item[\textit{normalized\_mean\_square\_error}]

This value is the normalized mean quantization error for any single pixel in the image.  This distance measure is normalized to a range between 0 and 1.  It is independent of the range of red, green, and blue values in the image.

\item[\textit{normalized\_maximum\_square\_error}]

Thsi value is the normalized maximum quantization error for any single pixel in the image.  This distance measure is normalized to a range between 0 and 1.  It is independent of the range of red, green, and blue values in your image.

\end{description}


\smallskip

{\em unsigned int QuantizationError (Image \*image) }


\begin{description}

\item[\textit{image}]

Specifies a pointer to an Image structure returned from ReadImage.

\end{description}

\subsection{QuantizeImage}

Method QuantizeImage analyzes the colors within a reference image and chooses a fixed number of colors to represent the image.  The goal of the algorithm is to minimize the difference between the input and output image while minimizing the processing time.


\smallskip

{\em unsigned int QuantizeImage (const QuantizeInfo \*quantize\_info, Image \*image) }

\smallskip

\begin{description}

\item[\textit{quantize\_info}]

Specifies a pointer to an QuantizeInfo structure.

\item[\textit{image}]

Specifies a pointer to a Image structure.

\end{description}

\subsection{QuantizeImages}

QuantizeImages analyzes the colors within a set of reference images and chooses a fixed number of colors to represent the set.  The goal of the algorithm is to minimize the difference between the input and output images while minimizing the processing time.


\smallskip

{\em unsigned int QuantizeImages (const QuantizeInfo \*quantize\_info, Image \*images) }

\smallskip

\begin{description}

\item[\textit{quantize\_info}]

Specifies a pointer to an QuantizeInfo structure.

\item[\textit{images}]

Specifies a pointer to a list of Image structures.

\end{description}
\section{Methods to Segment an Image with Thresholding Fuzzy c-Means}

\subsection{SegmentImage}

Method SegmentImage segment an image by analyzing the histograms of the color components and identifying units that are homogeneous with the fuzzy c-means technique.


Specify cluster threshold as the number of pixels in each cluster must exceed the the cluster threshold to be considered valid.  Smoothing threshold eliminates noise in the second derivative of the histogram.  As the value is increased, you can expect a smoother second derivative.  The default is 1.5.


\smallskip

{\em unsigned int SegmentImage (Image \*image, const ColorspaceType colorspace, const unsigned int verbose, const double cluster\_threshold, const double smoothing\_threshold) }


\begin{description}

\item[\textit{colors}]

The SegmentImage function returns this integer value.  It is the actual number of colors allocated in the colormap.

\item[\textit{image}]

Specifies a pointer to an Image structure returned from ReadImage.

\item[\textit{colorspace}]

An unsigned integer value that indicates the colorspace.  Empirical evidence suggests that distances in YUV or YIQ correspond to perceptual color differences more closely than do distances in RGB space.  The image is then returned to RGB colorspace after color reduction.

\item[\textit{verbose}]

A value greater than zero prints detailed information about the identified classes.

\end{description}
\section{Methods to Shear or Rotate an Image by an Arbitrary Angle}

\subsection{RotateImage}

Method RotateImage creates a new image that is a rotated copy of an existing one.  Positive angles rotate counter-clockwise (right-hand rule), while negative angles rotate clockwise.  Rotated images are usually larger than the originals and have 'empty' triangular corners.  X axis.  Empty triangles left over from shearing the image are filled with the color defined by the pixel at location (0,0). RotateImage allocates the memory necessary for the new Image structure and returns a pointer to the new image.


Method RotateImage is based on the paper "A Fast Algorithm for General Raster Rotatation" by Alan W.  Paeth.  RotateImage is adapted from a similar method based on the Paeth paper written by Michael Halle of the Spatial Imaging Group, MIT Media Lab.


\smallskip

{\em Image \*RotateImage (Image \*image, const double degrees, ExceptionInfo \*exception) }


\begin{description}

\item[\textit{status}]

Method RotateImage returns a pointer to the image after rotating.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{degrees}]

Specifies the number of degrees to rotate the image.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{ShearImage}

Method ShearImage creates a new image that is a shear\_image copy of an existing one.  Shearing slides one edge of an image along the X or Y axis, creating a parallelogram.  An X direction shear slides an edge along the X axis, while a Y direction shear slides an edge along the Y axis.  The amount of the shear is controlled by a shear angle.  For X direction shears, x\_shear is measured relative to the Y axis, and similarly, for Y direction shears y\_shear is measured relative to the X axis.  Empty triangles left over from shearing the image are filled with the color defined by the pixel at location (0,0). ShearImage allocates the memory necessary for the new Image structure and returns a pointer to the new image.


Method ShearImage is based on the paper "A Fast Algorithm for General Raster Rotatation" by Alan W.  Paeth.


\smallskip

{\em Image \*ShearImage (Image \*image, const double x\_shear, const double y\_shear, ExceptionInfo \*exception) }


\begin{description}

\item[\textit{status}]

Method ShearImage returns a pointer to the image after rotating.  A null image is returned if there is a memory shortage.

\item[\textit{image}]

The address of a structure of type Image returned from ReadImage.

\item[\textit{x\_shear, y\_shear}]

Specifies the number of degrees to shear the image.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}
\section{Methods to Compute a Digital Signature for an Image}

\subsection{SignatureImage}

Method SignatureImage computes a digital signature from an image.  This signature uniquely identifies the image and is convenient for determining if the colormap of a sequence of images is identical when animating.  The digital signature is from RSA Data Security MD5 Digest Algorithm described in Internet draft [MD5], July 1992, computed on the pixels after expanding them to 64-bit RGBA representation, with the two bytes of each 16-bit sample ordered most significant byte first.  The signature is in RGBA or CMYK order depending on the colorspace of the image.  If the image does not have any alpha information, an opaque value (65535) is used.


\smallskip

{\em unsigned int SignatureImage (Image \*image) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image.

\end{description}
\section{Image Pixel FIFO}

\subsection{ReadStream}

Method ReadStream makes the image pixels available to a user supplied callback method immediately upon reading a scanline with the ReadImage() method.


\smallskip

{\em unsigned int ReadStream (const ImageInfo \*image\_info, void (\*Stream) (const Image \*, const void \*, const size\_t), ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{status}]

Method ReadStream returns True if the image pixels are streamed to the user supplied callback method otherwise False.

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\item[\textit{stream}]

a callback method.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{WriteStream}

Method WriteStream makes the image pixels available to a user supplied callback method immediately upon writing pixel data with the WriteImage() method.


\smallskip

{\em unsigned int WriteStream (const ImageInfo \*image\_info, Image \*, int (\*Stream) (const Image \*, const void \*, const size\_t)) }

\smallskip

\begin{description}

\item[\textit{status}]

Method WriteStream returns True if the image pixels are streamed to the user supplied callback method otherwise False.

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\item[\textit{stream}]

a callback method.

\end{description}
\section{Image Text Attributes Methods}

\subsection{DestroyImageAttributes}

Method DestroyImageAttributes deallocates memory associated with the image attribute list.


\smallskip

{\em DestroyImageAttributes (Image \*image) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{GetImageAttribute}

Method GetImageAttribute searches the list of image attributes and returns a pointer to attribute if it exists otherwise NULL.


\smallskip

{\em ImageAttribute \*GetImageAttribute (const Image \*image, const char \*key) }

\smallskip

\begin{description}

\item[\textit{attribute}]

Method GetImageAttribute returns the attribute if it exists otherwise NULL.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{key}]

These character strings are the name of an image attribute to return.

\end{description}

\subsection{GetImageInfoAttribute}

Method GetImageInfoAttribute returns a "fake" attribute based on data in the image info or image structures.


\smallskip

    ImageAttribute \*GetImageAttribute(const Image \*image,const char \*key)

\smallskip

\begin{description}

\item[\textit{attribute}]

Method GetImageInfoAttribute returns the attribute if it exists otherwise NULL.

\item[\textit{image\_info}]

The address of a structure of type ImageInfo.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{key}]

These character strings are the name of an image attribute to return.

\end{description}

\subsection{SetImageAttribute}

Method SetImageAttribute searches the list of image attributes and replaces the attribute value.  If it is not found in the list, the attribute name and value is added to the list.  If the attribute exists in the list, the value is concatenated to the attribute.  SetImageAttribute returns True if the attribute is successfully concatenated or added to the list, otherwise False.  If the value is NULL, the matching key is deleted from the list.


\smallskip

{\em unsigned int SetImageAttribute (Image \*image, const char \*key, const char \*value) }

\smallskip

\begin{description}

\item[\textit{status}]

Method SetImageAttribute returns True if the attribute is successfully replaced or added to the list, otherwise False.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{key,value}]

These character strings are the name and value of an image attribute to replace or add to the list.

\end{description}

\subsection{StoreImageAttribute}

Method StoreImageAttribute is used to store an image attribute from a text string with the syntax: NAME=VALUE.


\smallskip

{\em StoreImageAttribute (Image \*image, char \*text) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{text}]

The text string that is parsed and used to determine the name and value of the new attribute.

\end{description}
\section{Methods to Get or Set Image Pixels}

\subsection{ClosePixelCache}

Method ClosePixelCache closes the pixel cache.  Use this method to prevent the too many file descriptors from being allocated when reading an image sequence.  File descriptors are only used for a disk-based cache.  This is essentially a no-op for a memory-based cache.


\smallskip

{\em void ClosePixelCache (Image \*image) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{DestroyPixelCache}

Method DestroyPixelCache deallocates memory associated with the pixel cache.


\smallskip

{\em void DestroyPixelCache (Image \*image) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{GetIndexesFromCache}

Method GetIndexesFromCache returns the colormap indexes associated with the last call to the SetPixelCache() or GetPixelCache() methods.


\smallskip

{\em IndexPacket \*GetIndexesFromCache (const Image \*image) }

\smallskip

\begin{description}

\item[\textit{indexes}]

Method GetIndexesFromCache returns the colormap indexes associated with the last call to the SetPixelCache() or GetPixelCache() methods.

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{GetOnePixelFromCache}

Method GetOnePixelFromCache returns a single pixel at the specified (x,y) location.  The image background color is returned if an error occurs.


\smallskip

{\em PixelPacket \*GetOnePixelFromCache (const Image image, const int x, const int y) }

\smallskip

\begin{description}

\item[\textit{pixels}]

Method GetOnePixelFromCache returns a pixel at the specified (x,y) location.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{x,y}]

These values define the location of the pixel to return.

\end{description}

\subsection{GetPixelCache}

Method GetPixelCache gets pixels from the in-memory or disk pixel cache as defined by the geometry parameters.  A pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.


\smallskip

{\em PixelPacket \*GetPixelCache (Image \*image, const int x, const int y, const unsigned int columns, const unsigned int rows) }

\smallskip

\begin{description}

\item[\textit{status}]

Method GetPixelCache returns a pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{x,y,columns,rows}]

These values define the perimeter of a region of pixels.

\end{description}

\subsection{GetPixelsFromCache}

Method GetPixelsFromCache returns the pixels associated with the last call to the SetPixelCache() or GetPixelCache() methods.


\smallskip

{\em PixelPacket \*GetPixelsFromCache (const Image image) }

\smallskip

\begin{description}

\item[\textit{pixels}]

Method GetPixelsFromCache returns the pixels associated with the last call to the SetPixelCache() or GetPixelCache() methods.

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{SetPixelCache}

Method SetPixelCache allocates an area to store image pixels as defined by the region rectangle and returns a pointer to the area.  This area is subsequently transferred from the pixel cache with method SyncPixelCache.  A pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.


\smallskip

{\em PixelPacket \*SetPixelCache (Image \*image, const int x, const int y, const unsigned int columns, const unsigned int rows) }

\smallskip

\begin{description}

\item[\textit{pixels}]

Method SetPixelCache returns a pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{x,y,columns,rows}]

These values define the perimeter of a region of pixels.

\end{description}

\subsection{SyncPixelCache}

Method SyncPixelCache saves the image pixels to the in-memory or disk cache.  The method returns True if the pixel region is synced, otherwise False.


\smallskip

{\em unsigned int SyncPixelCache (Image \*image) }

\smallskip

\begin{description}

\item[\textit{status}]

Method SyncPixelCache returns True if the image pixels are transferred to the in-memory or disk cache otherwise False.

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{WriteCacheInfo}

Method WriteCacheInfo writes the persistent cache meta information to a file on disk.


\smallskip

{\em unsigned int WriteCacheInfo (Image \*image) }

\smallskip

\begin{description}

\item[\textit{status}]

Method WriteCacheInfo returns True if the cache meta information is written to the specified file, otherwise False.

\item[\textit{image}]

The address of a structure of type Image.

\end{description}
\section{}

\subsection{BlobToImage}

Method BlobToImage implements direct to memory image formats.  It returns the blob as an image.


\smallskip

{\em Image \*BlobToImage (const ImageInfo \*image\_info, const void \*blob, const size\_t length, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{image}]

Method BlobToImage returns an image from the supplied blob.  If an error occurs NULL is returned.

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\item[\textit{blob}]

The address of a character stream in one of the image formats understood by ImageMagick.

\item[\textit{length}]

This size\_t integer reflects the length in bytes of the blob.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{DestroyBlobInfo}

Method DestroyBlobInfo deallocates memory associated with an BlobInfo structure.


\smallskip

{\em void DestroyBlobInfo (BlobInfo \*blob) }

\smallskip

\begin{description}

\item[\textit{blob}]

Specifies a pointer to a BlobInfo structure.

\end{description}

\subsection{GetBlobInfo}

Method GetBlobInfo initializes the BlobInfo structure.


\smallskip

{\em void GetBlobInfo (BlobInfo \*blob) }

\smallskip

\begin{description}

\item[\textit{blob}]

Specifies a pointer to a BlobInfo structure.

\end{description}

\subsection{ImageToBlob}

Method ImageToBlob implements direct to memory image formats.  It returns the image as a blob and its length.  The magick member of the Image structure determines the format of the returned blob (GIG, JPEG, PNG, etc.).


\smallskip

{\em void \*ImageToBlob (const ImageInfo \*image\_info, Image \*image, size\_t \*length, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{blob}]

Method ImageToBlob returns a chunk of memory written in the desired image format (e.g.  JPEG, GIF, etc.). If an error occurs NULL is returned.

\item[\textit{image\_info}]

Specifies a pointer to an ImageInfo structure.

\item[\textit{image}]

The address of a structure of type Image.

\item[\textit{length}]

This pointer to a size\_t integer sets the initial length of the blob.  On return, it reflects the actual length of the blob.

\item[\textit{exception}]

return any errors or warnings in this structure.

\end{description}

\subsection{SetBlobQuantum}

Method SetBlobQuantum set the current value of the blob quantum.  This is the size in bytes to add to a blob when writing to a blob exceeds its current length.


\smallskip

{\em void SetBlobQuantum (BlobInfo \*blob, const size\_t quantum) }

\smallskip

\begin{description}

\item[\textit{blob}]

A pointer to a BlobInfo structure.

\item[\textit{quantum}]

A size\_t that reflects the number of bytes to increase a blob.

\end{description}
\section{Methods to Read or List ImageMagick Image formats}

\subsection{DestroyMagickInfo}

Method DestroyMagickInfo deallocates memory associated MagickInfo list.


\smallskip

{\em void DestroyMagickInfo (void) }
\subsection{GetImageMagick}

Method GetImageMagick searches for an image format that matches the specified magick string.  If one is found the tag is returned otherwise NULL.


\smallskip

{\em char \*GetImageMagick (const unsigned char \*magick, const unsigned int length) }

\smallskip

\begin{description}

\item[\textit{tag}]

Method GetImageMagick returns a tag that matches the specified magick string.

\item[\textit{magick}]

a character string that represents the image format we are looking for.

\item[\textit{length}]

The length of the binary string.

\end{description}

\subsection{GetMagickConfigurePath}

Method GetMagickConfigurePath searches a number of pre-defined locations for the specified ImageMagick configuration file and returns the path.  The search order follows:

           MagickModulesPath
           $HOME/.magick/
           $MAGICK\_HOME/
           <program directory>/
           MagickLibPath
           MagickSharePath
           X11ConfigurePath

\smallskip

{\em char \*GetMagickConfigurePath (const char \*filename) }

\smallskip

\begin{description}

\item[\textit{path}]

Method GetMagickConfigurePath returns the path if the configuration file is found, otherwise NULL is returned.

\item[\textit{filename}]

A character string representing the desired configuration file.

\end{description}

\subsection{GetMagickInfo}

Method GetMagickInfo returns a pointer MagickInfo structure that matches the specified tag.  If tag is NULL, the head of the image format list is returned.


\smallskip

{\em MagickInfo \*GetMagickInfo (const char \*tag) }

\smallskip

\begin{description}

\item[\textit{magick\_info}]

Method GetMagickInfo returns a pointer MagickInfo structure that matches the specified tag.

\item[\textit{tag}]

a character string that represents the image format we are looking for.

\end{description}

\subsection{GetMagickVersion}

Method GetMagickVersion returns the ImageMagick API version as a string and as a number.


\smallskip

{\em char \*GetMagickVersion (unsigned int \*version) }

\smallskip

\begin{description}

\item[\textit{string}]

Method GetMagickVersion returns the ImageMagick version string.

\item[\textit{version}]

The ImageMagick version is returned as a number.

\end{description}

\subsection{ListMagickInfo}

Method ListMagickInfo lists the image formats to a file.


\smallskip

{\em void ListMagickInfo (FILE \*file) }


\begin{description}

\item[\textit{file}]

A pointer to a FILE structure.

\end{description}

\subsection{MagickIncarnate}

Method MagickIncarnate initializes the ImageMagick environment.


\smallskip

{\em MagickIncarnate (const char \*path) }

\smallskip

\begin{description}

\item[\textit{path}]

Specifies a pointer to the execution path of the current ImageMagick client.

\end{description}

\subsection{RegisterMagickInfo}

Method RegisterMagickInfo adds attributes for a particular image format to the list of supported formats.  The attributes include the image format tag, a method to read and/or write the format, whether the format supports the saving of more than one frame to the same file or blob, whether the format supports native in-memory I/O, and a brief description of the format.


\smallskip

{\em MagickInfo \*RegisterMagickInfo (MagickInfo \*entry) }

\smallskip

\begin{description}

\item[\textit{magick\_info}]

Method RegisterMagickInfo returns a pointer MagickInfo structure that contains the specified tag info.

\item[\textit{entry}]

A pointer to a structure of type MagickInfo.

\end{description}

\subsection{SetMagickInfo}

Method SetMagickInfo allocates a MagickInfo structure and initializes the members to default values.


\smallskip

{\em MagickInfo \*SetMagickInfo (const char \*tag) }

\smallskip

\begin{description}

\item[\textit{magick\_info}]

Method SetMagickInfo returns the allocated and initialized MagickInfo structure.

\item[\textit{tag}]

a character string that represents the image format associated with the MagickInfo structure.

\end{description}

\subsection{UnregisterMagickInfo}

Method UnregisterMagickInfo removes a tag from the magick info list.  It returns False if the tag does not exist in the list otherwise True.


\smallskip

{\em unsigned int UnregisterMagickInfo (const char \*tag) }

\smallskip

\begin{description}

\item[\textit{status}]

Method UnregisterMagickInfo returns False if the tag does not exist in the list otherwise True.

\item[\textit{tag}]

a character string that represents the image format we are looking for.

\end{description}
\section{ImageMagick Error Methods}

\subsection{CatchImageException}

Method CatchImageException returns if no exceptions are found in the image sequence, otherwise it determines the most severe exception and reports it as a warning or error depending on the severity.


\smallskip

{\em CatchImageException (Image \*image) }

\smallskip

\begin{description}

\item[\textit{image}]

Specifies a pointer to a list of one or more images.

\end{description}

\subsection{DestroyExceptionInfo}

Method DestroyExceptionInfo deallocates memory associated with an ExceptionInfo structure.


\smallskip

{\em void DestroyExceptionInfo (ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{exception}]

Specifies a pointer to an ExceptionInfo structure.

\end{description}

\subsection{GetExceptionInfo}

Method GetExceptionInfo initializes the ExceptionInfo structure.


\smallskip

{\em GetExceptionInfo (ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{error\_info}]

Specifies a pointer to a ExceptionInfo structure.

\end{description}

\subsection{GetImageException}

Method GetImageException traverses an image sequence and returns any error more severe than noted by the exception parameter.


\smallskip

{\em GetImageException (Image \*image, ExceptionInfo \*exception) }

\smallskip

\begin{description}

\item[\textit{image}]

Specifies a pointer to a list of one or more images.

\item[\textit{exception}]

return the highest severity exception.

\end{description}

\subsection{MagickError}

Method MagickError calls the error handler methods with an error reason.


\smallskip

{\em void MagickError (const ExceptionType error, const char \*reason, const char \*description) }

\smallskip

\begin{description}

\item[\textit{exception}]

Specifies the numeric error category.

\item[\textit{reason}]

Specifies the reason to display before terminating the program.

\item[\textit{description}]

Specifies any description to the reason.

\end{description}

\subsection{MagickWarning}

Method MagickWarning calls the warning handler methods with a warning reason.


\smallskip

{\em void MagickWarning (const ExceptionType warning, const char \*reason, const char \*description) }

\smallskip

\begin{description}

\item[\textit{warning}]

Specifies the numeric warning category.

\item[\textit{reason}]

Specifies the reason to display before terminating the program.

\item[\textit{description}]

Specifies any description to the reason.

\end{description}

\subsection{SetErrorHandler}

Method SetErrorHandler sets the error handler to the specified method and returns the previous error handler.


\smallskip

{\em ErrorHandler SetErrorHandler (ErrorHandler handler) }

\smallskip

\begin{description}

\item[\textit{handler}]

Specifies a pointer to a method to handle errors.

\end{description}

\subsection{SetWarningHandler}

Method SetWarningHandler sets the warning handler to the specified method and returns the previous warning handler.


\smallskip

{\em ErrorHandler SetWarningHandler (ErrorHandler handler) }

\smallskip

\begin{description}

\item[\textit{handler}]

Specifies a pointer to a method to handle warnings.

\end{description}

\subsection{ThrowException}

Method ThrowException throws an exception with the specified severity code, reason, and optional description.


\smallskip

{\em void ThrowException (ExceptionInfo \*exception, const ExceptionType severity, const char \*reason, const char \*description) }

\smallskip

\begin{description}

\item[\textit{exception}]

Specifies a pointer to the ExceptionInfo structure.

\item[\textit{severity}]

This ExceptionType declares the severity of the exception.

\item[\textit{reason}]

Specifies the reason to display before terminating the program.

\item[\textit{description}]

Specifies any description to the reason.

\end{description}
\section{ImageMagick Memory Allocation Methods}

\subsection{AcquireMemory}

Method AcquireMemory returns a pointer to a block of at least size bytes suitably aligned for any use.


\smallskip

{\em void \*AcquireMemory (const size\_t size) }

\smallskip

\begin{description}

\item[\textit{memory}]

Method AcquireMemory returns a pointer to a block of at least size bytes suitably aligned for any use.

\item[\textit{size}]

Specifies the size of the memory to return.

\end{description}

\subsection{LiberateMemory}

Method LiberateMemory frees memory that has already been allocated.


\smallskip

{\em void LiberateMemory (void \*\*memory) }

\smallskip

\begin{description}

\item[\textit{span}]

Specifies the pointer to a block memory to free for reuse.

\end{description}

\subsection{ReacquireMemory}

Method ReacquireMemory changes the size of the memory and returns a pointer to the (possibly moved) block.  The contents will be unchanged up to the lesser of the new and old sizes.


\smallskip

{\em void ReacquireMemory (void \*\*memory, const size\_t size) }

\smallskip

\begin{description}

\item[\textit{memory}]

Method ReacquireMemory returns a pointer to a block of at least size bytes suitably aligned for any use.

\item[\textit{size}]

Specifies the size of the memory to return.

\end{description}
\section{ImageMagick Progress Monitor Methods}

\subsection{MagickMonitor}

Method MagickMonitor calls the monitor handler methods with a text string that describes the task and a measure of completion.


\smallskip

{\em void MagickMonitor (const char \*text, const off\_t quantum, const off\_t span) }

\smallskip

\begin{description}

\item[\textit{quantum}]

Specifies the quantum position within the span which represents how much progress has been made in completing a task.

\item[\textit{span}]

Specifies the span relative to completing a task.

\end{description}

\subsection{SetMonitorHandler}

Method SetMonitorHandler sets the monitor handler to the specified method and returns the previous monitor handler.


\smallskip

{\em MonitorHandler SetMonitorHandler (MonitorHandler handler) }

\smallskip

\begin{description}

\item[\textit{handler}]

Specifies a pointer to a method to handle monitors.

\end{description}
\section{Methods to Interactively Animate an Image Sequence}

\subsection{XAnimateBackgroundImage}

Method XAnimateBackgroundImage animates an image sequence in the background of a window.


\smallskip

{\em void XAnimateBackgroundImage (Display \*display, XResourceInfo \*resource\_info, Image \*image) }

\smallskip

\begin{description}

\item[\textit{display}]

Specifies a connection to an X server returned from XOpenDisplay.

\item[\textit{resource\_info}]

Specifies a pointer to a X11 XResourceInfo structure.

\item[\textit{image}]

Specifies a pointer to a Image structure returned from ReadImage.

\end{description}

\subsection{XAnimateImage}

Method XAnimateImages displays an image via X11.


\smallskip

{\em Image \*XAnimateImages(Display \*display,XResourceInfo \*resource\_info,
    char \*\*argv,const int argc,Image \*image)}

\smallskip

\begin{description}

\item[\textit{display}]

Specifies a connection to an X server returned from XOpenDisplay.

\item[\textit{resource\_info}]

Specifies a pointer to a X11 XResourceInfo structure.

\item[\textit{argv}]

Specifies the application's argument list.

\item[\textit{argc}]

Specifies the number of arguments.

\item[\textit{image}]

Specifies a pointer to a Image structure returned from ReadImage.

\end{description}
\section{Methods to Interactively Display and Edit an Image}

\subsection{XDisplayBackgroundImage}

Method XDisplayBackgroundImage displays an image in the background of a window.


\smallskip

{\em unsigned int XDisplayBackgroundImage (Display \*display, XResourceInfo \*resource\_info, Image \*image) }

\smallskip

\begin{description}

\item[\textit{status}]

Method XDisplayBackgroundImage returns True if the designated window is the root window.

\item[\textit{display}]

Specifies a connection to an X server returned from XOpenDisplay.

\item[\textit{resource\_info}]

Specifies a pointer to a X11 XResourceInfo structure.

\item[\textit{image}]

Specifies a pointer to a Image structure returned from ReadImage.

\end{description}

\subsection{XDisplayImage}

Method XDisplayImage displays an image via X11.  A new image is created and returned if the user interactively transforms the displayed image.


\smallskip

{\em Image \*XDisplayImage (Display \*display, XResourceInfo \*resource\_info, char \*\*argv, int argc, Image \*\*image, unsigned long \*state) }

\smallskip

\begin{description}

\item[\textit{nexus}]

Method XDisplayImage returns an image when the user chooses 'Open Image' from the command menu or picks a tile from the image directory.  Otherwise a null image is returned.

\item[\textit{display}]

Specifies a connection to an X server returned from XOpenDisplay.

\item[\textit{resource\_info}]

Specifies a pointer to a X11 XResourceInfo structure.

\item[\textit{argv}]

Specifies the application's argument list.

\item[\textit{argc}]

Specifies the number of arguments.

\item[\textit{image}]

Specifies an address to an address of an Image structure returned from ReadImage.

\end{description}
\section{ImageMagick Cache Views Methods}

\subsection{CloseCacheView}

Method CloseCacheView closes the specified view returned by a previous call to OpenCacheView().


\smallskip

{\em void CloseCacheView (ViewInfo \*view) }

\smallskip

\begin{description}

\item[\textit{view}]

The address of a structure of type ViewInfo.

\end{description}

\subsection{GetCacheView}

Method GetCacheView gets pixels from the in-memory or disk pixel cache as defined by the geometry parameters.  A pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.


\smallskip

{\em PixelPacket \*GetCacheView (ViewInfo \*view, const int x, const int y, const unsigned int columns, const unsigned int rows) }

\smallskip

\begin{description}

\item[\textit{pixels}]

Method GetCacheView returns a null pointer if an error occurs, otherwise a pointer to the view pixels.

\item[\textit{view}]

The address of a structure of type ViewInfo.

\item[\textit{x,y,columns,rows}]

These values define the perimeter of a region of pixels.

\end{description}

\subsection{GetCacheViewIndexes}

Method GetCacheViewIndexes returns the colormap indexes associated with the specified view.


\smallskip

{\em IndexPacket \*GetCacheViewIndexes (const ViewInfo \*view) }

\smallskip

\begin{description}

\item[\textit{indexes}]

Method GetCacheViewIndexes returns the colormap indexes associated with the specified view.

\item[\textit{view}]

The address of a structure of type ViewInfo.

\end{description}

\subsection{GetCacheViewPixels}

Method GetCacheViewPixels returns the pixels associated with the specified specified view.


\smallskip

{\em PixelPacket \*GetCacheViewPixels (const ViewInfo \*view) }

\smallskip

\begin{description}

\item[\textit{pixels}]

Method GetCacheViewPixels returns the pixels associated with the specified view.

\item[\textit{view}]

The address of a structure of type ViewInfo.

\end{description}

\subsection{OpenCacheView}

Method OpenCacheView opens a view into the pixel cache.


\smallskip

{\em ViewInfo \*OpenCacheView (Image \*image) }

\smallskip

\begin{description}

\item[\textit{image}]

The address of a structure of type Image.

\end{description}

\subsection{SetCacheView}

Method SetCacheView gets pixels from the in-memory or disk pixel cache as defined by the geometry parameters.  A pointer to the pixels is returned if the pixels are transferred, otherwise a NULL is returned.


\smallskip

{\em PixelPacket \*SetCacheView (ViewInfo \*view, const int x, const int y, const unsigned int columns, const unsigned int rows) }

\smallskip

\begin{description}

\item[\textit{pixels}]

Method SetCacheView returns a null pointer if an error occurs, otherwise a pointer to the view pixels.

\item[\textit{view}]

The address of a structure of type ViewInfo.

\item[\textit{x,y,columns,rows}]

These values define the perimeter of a region of pixels.

\end{description}

\subsection{SyncCacheView}

Method SyncCacheView saves the view pixels to the in-memory or disk cache.  The method returns True if the pixel region is synced, otherwise False.


\smallskip

{\em unsigned int SyncCacheView (ViewInfo \*view) }

\smallskip

\begin{description}

\item[\textit{status}]

Method SyncCacheView returns True if the view pixels are transferred to the in-memory or disk cache otherwise False.

\item[\textit{view}]

The address of a structure of type ViewInfo.

\end{description}
