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

\section{Methods to Constitute an Image}

\subsubsection{ConstituteImage()}
create an image from pixel data.

\begin{quote}
\hspace*{-0.25in}
Image \*ConstituteImage (const unsigned int width,  const unsigned
int height,  const char \*map,  const StorageType type,  const void \*pixels, 
ExceptionInfo \*exception) 
\end{quote}

ConstituteImage() returns an image from the pixel data you supply.
The pixel data must be in scanline order top-to-bottom.
The data can be of type \var{char}, \var{short int}, \var{int},
\var{float}, or \var{double}.  \var{Float} and \var{double} require the
pixels to be normalized [0..1] otherwise [0..MaxRGB].   For example, to
create a 640 x 480 image from unsigned red-green-blue character data, use

{\small
\begin{verbatim}
    image = ConstituteImage(640, 480, "RGB", CharPixel, pixels, exception);
\end{verbatim}
}

A description of each parameter follows:

\begin{description}
\item[width] Width in pixels of the image.
\item[height] Height in pixels of the image.
\item[map] This string reflects the expected ordering of the pixel array.  It
can be any combination or order of R = red, G = green, B = blue, A = alpha,
C = cyan, Y = yellow, M = magenta, K = black, or I = intensity (for grayscale).
\item[type] Define the data type of the pixels.  Float and double types are
expected to be normalized [0..1] otherwise [0..MaxRGB].  Choose from these
types:

\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> CharPixel \> ShortPixel \> IntegerPixel \\
\> FloatPixel \> DoublePixel \> 
\end{tabbing}
\item[pixels] This array of values contain the pixel components as defined by
\texttt{map} and \texttt{type}.  The expected length of the array varies
 depending on the values of \texttt{width}, \texttt{height}, and \texttt{type}.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{DispatchImage()}
create pixel data from an image.

\begin{quote}
\hspace*{-0.25in}
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)
\end{quote}

DispatchImage() extracts pixel data from an image and returns it to
you as \texttt{pixels}.  The method returns False on success otherwise
True if an error is encountered.  The data is returned as \var{char},
\var{short int}, \var{int}, \var{float}, or \var{double} in the order
specified by \texttt{map}.  Suppose we want want to extract the first
scanline of a 640x480 image as character data in red-green-blue order:

{\small
\begin{verbatim}
    status = DispatchImage(image, 0, 0, 640, 1, "RGB", 0, pixels);
\end{verbatim}
}

A description of each parameter follows:

\begin{description}

\item[image] The image.
\item[x, y, columns, rows] These values define the perimeter of a region of
pixels you want to extract.
\item[map] This string reflects the expected ordering of the pixel array.  It
can be any combination or order of R = red, G = green, B = blue, A = alpha,
C = cyan, Y = yellow, M = magenta, K = black, or I = intensity (for grayscale).
\item[type] Define the data type of the pixels.  Float and double types are
normalized to [0..1] otherwise [0..MaxRGB].  Choose from these types:

\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> CharPixel \> ShortPixel \> IntegerPixel \\
\> FloatPixel \> DoublePixel \> 
\end{tabbing}
\item[pixels] This array of values contain the pixel components as defined by
\texttt{map} and \texttt{type}.  You must preallocate this array where the
expected lengthvaries depending on the values of \texttt{width},
\texttt{height}, and \texttt{type}.
\end{description}

\subsubsection{PingImage()}
get information about an image.

\begin{quote}
\hspace*{-0.25in}
Image \*PingImage(const ImageInfo \*image\_info, ExceptionInfo \*exception)
\end{quote}

PingImage() is a convenience method that returns information about an
image without having to read the image into memory.  It returns the
width, height, file size in bytes, and the file format of the image.
For an image sequence, only the information for the first image
in the sequence is returned.

PingImage() returns an \texttt{Image} on success and NULL if the image
cannot be pinged.  The image does not contain any pixel data.

A description of each parameter follows:

\begin{description}
\item[image\_info] Ping the image defined by the \texttt{file} or
\texttt{filename} members of this structure.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{ReadImage()}
read one or more image files.

\begin{quote}
\hspace*{-0.25in}
Image \*ReadImage(const ImageInfo \*image\_info, ExceptionInfo \*exception) 
\end{quote}

ReadImage() reads an image or image sequence from a file or file handle.
The method returns a NULL if there is a memory shortage or if the image cannot
be read.

A description of each parameter follows:

\begin{description}
\item[image\_info] Read the image defined by the \texttt{file} or
\texttt{filename} members of this structure.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{WriteImage()}
write one or more image files.

\begin{quote}
\hspace*{-0.25in}
unsigned int WriteImage(const ImageInfo \*image\_info, Image \*image) 
\end{quote}

Write() allows you to write a single or image or a sequence to a file or
filehandle.  Write() returns a value other than 0 if the image is written.
If 0 is returned, check the \texttt{exception} member of \texttt{image} to
determine why the image failed to write.

A description of each parameter follows:

\begin{description}
\item[image\_info] Write the image defined by the \texttt{file} or
\texttt{filename} members of this structure.
\item[image] The image.
\end{description}

\section{ImageMagick Image Methods}

\subsubsection{AllocateImage()}
allocate an image.

\begin{quote}
\hspace*{-0.25in}
Image \*AllocateImage(const ImageInfo \*image\_info)
\end{quote}

AllocateImage() returns a pointer to an image structure initialized to
default values. 

A description of each parameter follows:

\begin{description}
\item[image\_info] Many of the image default values are set from this
structure.  For example, filename, compression, depth, background color, and
others.
\end{description}

\subsubsection{AllocateImageColormap()}
allocate an image colormap.

\begin{quote}
\hspace*{-0.25in}
unsigned int AllocateImageColormap(Image \*image, const unsigned int colors) 
\end{quote}

AllocateImageColormap() allocates an image colormap and initializes
it to a linear gray colorspace.  If the image already has a colormap,
it is replaced.  AllocateImageColormap() returns True if successful,
otherwise False if there is not enough memory.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[colors] The number of colors in the image colormap.
\end{description}

\subsubsection{AllocateNextImage()}
allocate the next image in a sequence.

\begin{quote}
\hspace*{-0.25in}
void AllocateNextImage(const ImageInfo \*image\_info, Image \*image)
\end{quote}

Use AllocateNextImage() to initialize the next image in a sequence.  The
\texttt{next} member of \texttt{image} points to the newly allocated image.
If there is a memory shortage, \texttt{next} is assigned NULL.

A description of each parameter follows:

\begin{description}

\item[image\_info] Many of the image default values are set from this
structure.  For example, filename, compression, depth, background color, and
others.
\item[image] The image.
\end{description}

\subsubsection{AnimateImages()}
animate an image sequence.

\begin{quote}
\hspace*{-0.25in}
unsigned int AnimateImages(const ImageInfo \*image\_info, Image \*image) 
\end{quote}

AnimateImages() repeatedly displays an image sequence to any X window
screen.  It returns a value other than 0 if successful.  Check the
\texttt{exception} member of \texttt{image} to determine the reason for
any failure.

A description of each parameter follows:

\begin{description}

\item[image\_info] The image info.
\item[image] The image.
\end{description}

\subsubsection{AppendImages()}
append a set of images.

\begin{quote}
\hspace*{-0.25in}
Image \*AppendImages (Image \*image, const unsigned int stack,
  ExceptionInfo \*exception) 
\end{quote}

The Append() method takes a set of images and appends them to each
other.  Each image in the set must have the equal width or equal height
(or both).  Append() returns a single image where each image in the original
set is side-by-side if all the heights are equal or stacked on top of
each other if all widths are equal.  On failure, a NULL image is returned
and \texttt{exception} describes the reason for the failure.

A description of each parameter follows:

\begin{description}
\item[image] The image sequence.
\item[stack] An unsigned value other than stacks rectangular image top-to-bottom
otherwise left-to-right.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{AverageImages()}
average a set of images.

\begin{quote}
\hspace*{-0.25in}
Image \*AverageImages (const Image \*image,  ExceptionInfo \*exception)
\end{quote}

The Average() method takes a set of images and averages them together.
Each image in the set must have the same width and the same height.
Average() returns a single image with each corresponding pixel component
of each image averaged.   On failure, a NULL image is returned
and \texttt{exception} describes the reason for the failure.

A description of each parameter follows:

\begin{description}

\item[image] The image sequence.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{ChannelImage()}
extract a channel from the image.

\begin{quote}
\hspace*{-0.25in}
unsigned int ChannelImage (Image \*image,  const ChannelType channel)
\end{quote}

Extract a channel from the image.  A channel is a particular color component
of each pixel in the image.  Choose from these components:

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[channel] A value of type ChannelType that identifies which channel to
extract:

\begin{tabbing}
0000\=111111\kill
\> Red \\
\> Green \\
\> Blue \\
\> Matte
\end{tabbing}
\end{description}

\subsubsection{CloneImage()}
create a new copy of an image.

\begin{quote}
\hspace*{-0.25in}
Image \*CloneImage(Image \*image, const unsigned int columns, const
unsigned int rows, const unsigned int orphan, ExceptionInfo \*exception)
\end{quote}

CloneImage() copies an image and returns the copy as a new image object.
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 the SetImagePixels() and SyncImagePixels() methods.  A NULL image
is returned if the image cannot be cloned; check \texttt{exception}
for the reason why.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[columns] The number of columns in the cloned image.
\item[rows] The number of rows in the cloned image.
\item[orphan] With a value other than 0, the cloned image is an orphan.  An
orphan is a stand-alone image that is not assocated with an image list.  In
effect, the \texttt{next} and \texttt{previous} members of the cloned image
is set to NULL.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{CloneImageInfo()}
clone an image info structure.

\begin{quote}
\hspace*{-0.25in}
ImageInfo \*CloneImageInfo(const ImageInfo \*image\_info)
\end{quote}

CloneImageInfo() makes a copy of the given image info structure.  If
NULL is specified, a new image info structure is created initialized to
default values.

A description of each parameter follows:

\begin{description}
\item[image\_info] The image info.
\end{description}

\subsubsection{CompositeImage()}
composite one image to another.

\begin{quote}
\hspace*{-0.25in}
unsigned int CompositeImage(Image \*image, const CompositeOperator compose,
   Image \*composite\_image, const int x\_offset, const int y\_offset) 
\end{quote}

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

A description of each parameter follows:

\begin{description}

\item[image] The image.
\item[compose] This operator affects how the composite is applied to
the image.  The default is Over.  Choose from these operators:

\begin{tabbing}
0000\=11111111111111111111111\=22222222222222222222222\=333333333333333333333\kill
\> OverCompositeOP \> InCompositeOP \> OutCompositeOP \\
\> AtopCompositeOP \> XorCompositeOP \> PlusCompositeOP \\
\> MinusCompositeOP \> AddCompositeOP \> SubtractCompositeOP \\
\> DifferenceCompositeOP \> BumpmapCompositeOP \> CopyCompositeOP \\
\> DisplaceCompositeOP
\end{tabbing}
\item[composite\_image] The composite image.
\item[x\_offset] The column offset of the composited image.
\item[y\_offset] The row offset of the composited image.
\end{description}

\subsubsection{CycleColormapImage()}
displace a colormap.

\begin{quote}
\hspace*{-0.25in}
CycleColormapImage(Image \*image, const int amount)
\end{quote}

CycleColormap() displaces an image's colormap by a given number of positions.
If you cycle the colormap a number of times you can produce a psychodelic
effect.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[amount] Offset of the colormap this much.
\end{description}

\subsubsection{DescribeImage()}
describe an image.

\begin{quote}
\hspace*{-0.25in}
void DescribeImage (Image \*image, FILE \*file, const unsigned int verbose)
\end{quote}

DescribeImage() describes an image by printing its attributes to the
file.  Attributes include the image width, height, size, and others.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[file] The file, typically stdout.
\item[verbose] A value other than zero prints additional detailed information
about the image.
\end{description}

\subsubsection{DestroyImage()}
destroy an image.

\begin{quote}
\hspace*{-0.25in}
void DestroyImage(Image \*image)
\end{quote}

DestroyImage() deallocates memory associated with an image.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{DestroyImageInfo()}
destroy image info.

\begin{quote}
\hspace*{-0.25in}
void DestroyImageInfo(ImageInfo \*image\_info)
\end{quote}

DestroyImageInfo() deallocates memory associated with an ImageInfo structure.

A description of each parameter follows:

\begin{description}
\item[image\_info] The image info.
\end{description}

\subsubsection{DestroyImages()}
destroy an image sequence.

\begin{quote}
\hspace*{-0.25in}
void DestroyImages(Image \*image)
\end{quote}

DestroyImages() deallocates memory associated with all the images in a
sequence.

A description of each parameter follows:

\begin{description}
\item[image] The image sequence.
\end{description}

\subsubsection{DisplayImages()}
display an image sequence.

\begin{quote}
\hspace*{-0.25in}
unsigned int DisplayImages(const ImageInfo \*image\_info, Image \*image)
\end{quote}

DisplayImages() displays an image sequence to any X window
screen.  It returns a value other than 0 if successful.  Check the
\texttt{exception} member of \texttt{image} to determine the reason for
any failure.

A description of each parameter follows:

\begin{description}
\item[image\_info] The image info.
\item[image] The image.
\end{description}

\subsubsection{GetImageDepth()}
get image depth.

\begin{quote}
\hspace*{-0.25in}
unsigned int GetImageDepth(Image \*image)
\end{quote}

GetImageDepth() returns the depth of the image, either 8 or 16 bits.  By
default, pixels components are stored as 16-bit two byte unsigned short
integers that range in value from 0 to 65535.  However, if all the pixels have
lower-order bytes of zero, the image is considered to have a depth of 8-bit.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{GetImageInfo()}
get image info.

\begin{quote}
\hspace*{-0.25in}
void GetImageInfo(ImageInfo \*image\_info)
\end{quote}

GetImageInfo() initialized the ImageInfo structure to default values.

A description of each parameter follows:

\begin{description}

\item[image\_info] The image info.
\end{description}

\subsubsection{GetImageType()}
get image type.

\begin{quote}
\hspace*{-0.25in}
ImageType GetImageType(Image \*image)
\end{quote}

GetImageType() returns the type of image:

\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Bilevel \> Grayscale \> GrayscaleMatte \\
\> Palette \> PaletteMatte \> TrueColor\\ 
\> TrueColorMatte \>  ColorSeparation \>  ColorSeparationMatte
\end{tabbing}

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{GetNextImage()}
the next image in a sequence.

\begin{quote}
\hspace*{-0.25in}
Image \*GetNextImage(Image \*image)
\end{quote}

GetNextImage() returns the next image in an image sequence.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{GetNumberScenes()}
the number of images in a sequence.

\begin{quote}
\hspace*{-0.25in}
unsigned int GetNumberScenes(const Image \*image)
\end{quote}

GetNumberScenes() returns the number of images in an image sequence.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{IsImagesEqual()}
measure the pixel differences between two images.

\begin{quote}
\hspace*{-0.25in}
unsigned int IsImagesEqual(Image \*image, Image \*reference)
\end{quote}

IsImagesEqual() measures the difference between colors at each pixel
location of two images.  A value other than 0 means the colors match
exactly.  Otherwise an error measure 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.  The error
measure is assigned to these image members:

\begin{description}
\item[mean\_error\_per\_pixel] This value is the mean error for any single
pixel in the image.
\item[normalized\_mean\_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[normalized\_maximum\_error] This 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}

A small normalized mean square error, accessed as
\code{image->normalized\_mean\_error}, suggests the images are very
similiar in spatial layout and color.

A description of each parameter follows:
\begin{description}

\item[image] The image.
\item[reference] The reference image.
\end{description}

\subsubsection{IsImageTainted()}
tell if an image has been altered.

\begin{quote}
\hspace*{-0.25in}
 unsigned int IsImageTainted(const Image \*image)
\end{quote}

IsImageTainted() returns a value other than 0 if any pixel in an image
has been altered since it was first constituted.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{ListToGroupImage()}
convert an image list to an array.

\begin{quote}
\hspace*{-0.25in}
Image \*\*ListToGroupImage(Image \*image, unsigned int \*number\_images)
\end{quote}

ListToGroupImage() is a convenience method that converts a linked list of
images to a sequential array.  For example,

{\small
\begin{verbatim}
    images = ListToGroupImage(image_list, \&n);
    for (i=0; i < n; i++)
      puts(images[i]->filename);
\end{verbatim}
}

A description of each parameter follows:
\begin{description}
\item[image] The image list.
\item[number\_images] The length of the image array is returned here.
\end{description}

\subsubsection{ProfileImage()}
add or remove a profile.

\begin{quote}
\hspace*{-0.25in}
unsigned int ProfileImage(Image \*image, const char \*profile\_name, 
  const char \*filename)
\end{quote}

ProfileImage() adds or removes a ICM, IPTC, or generic profile to an
image.  If the profile name is defined it is deleted from the image.
If a filename is given, one or more profiles are read and added to the
image.  ProfileImage() returns a value other than 0 if the profile is
successfully added or removed from the image.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[profile\_name] The type of profile to add or remove.
\item[filename] The filename of the ICM, IPTC, or generic profile.
\end{description}

\subsubsection{SetImage()}
set image pixels to the background color.

\begin{quote}
\hspace*{-0.25in}
void SetImage(Image \*image, const Quantum opacity)
\end{quote}

SetImage() sets the red, green, and blue components of each pixel to
the image background color and the opacity component to the specified
level of transparency.  The background color is defined by the
\texttt{background\_color} member of the image.


A description of each parameter follows:
\begin{description}

\item[image] The image.
\item[opacity] Set each pixel to this level of transparency.
\end{description}

\subsubsection{SetImageClipMask()}

\begin{quote}
\hspace*{-0.25in}
unsigned int SetImageClipMask(Image \*image,Image \*clip_mask)
\end{quote}

SetImageDepth() associates a clip mask with the image.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[clip_mask] The clip mask.
\end{description}

\subsubsection{SetImageDepth()}

\begin{quote}
\hspace*{-0.25in}
unsigned int SetImageDepth(Image \*image,const unsigned int depth)
\end{quote}

SetImageDepth() sets the depth of the image, either 8 or 16.  Some image
formats support both 8 and 16-bits per color component (e.g. PNG).  Use
SetImageDepth() to specify your preference.  A value other than 0 is
returned if the depth is set.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[depth] The image depth.
\end{description}

\subsubsection{SetImageOpacity()}
set image pixels transparency level.

\begin{quote}
\hspace*{-0.25in}
void SetImageOpacity(Image \*image, const unsigned int opacity)
\end{quote}

SetImageOpacity() attenuates the opacity channel of an image.  If the
image pixels are opaque, they are set to the specified opacity level.
Otherwise, the pixel oapcity values are blended with the supplied
transparency value.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[opacity] The level of transparency: 0 is fully opaque and MaxRGB is
fully transparent.
\end{description}

\subsubsection{SetImageType()}
set image type.

\begin{quote}
\hspace*{-0.25in}
void SetImageType(Image \*image, const ImageType image\_type)
\end{quote}

SetImageType() sets the type of image.  Choose from these types:

\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Bilevel \> Grayscale \> GrayscaleMatte \\
\> Palette \> PaletteMatte \> TrueColor\\ 
\> TrueColorMatte \>  ColorSeparation \>  ColorSeparationMatte
\end{tabbing}

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[image\_type] Image type.
\end{description}

\subsubsection{TextureImage()}
tile a texture on image background.

\begin{quote}
\hspace*{-0.25in}
void TextureImage(Image \*image, Image \*texture)
\end{quote}

TextureImage() repeatedly tiles the texture image across and down the image
canvas.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[texture] This image is the texture to layer on the background.
\end{description}

\subsubsection{MagnifyImage()}
scale the image to twice its size.

\begin{quote}
\hspace*{-0.25in}
Image \*MagnifyImage(image, ExceptionInfo \*exception)
\end{quote}

MagnifyImage() is a convenience method that scales an image proportionally
to twice its size.  If a NULL image is returned, check the \texttt{exception}
member of \texttt{image} to determine why the image failed to magnify.

\begin{description}

\item[image] The image.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{MinifyImage()}
scale the image to half its size.

\begin{quote}
\hspace*{-0.25in}
Image \*MinifyImage(Image \*image, ExceptionInfo \*exception)
\end{quote}

MinifyImage() is a convenience method that scales an image proportionally
to half its size.  If a NULL image is returned, check the \texttt{exception}
member of \texttt{image} to determine why the image failed to minify.

A description of each parameter follows:
\begin{description}
\item[image] The image.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{ResizeImage()}
scale an image with a filter.

\begin{quote}
\hspace*{-0.25in}
Image \*ResizeImage(Image \*image, const unsigned int columns,
  const unsigned int rows, const FilterType filter,  const double blur, 
  ExceptionInfo \*exception)
\end{quote}

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

\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Bessel \> Blackman \> Box \\
\> Catrom \> Cubic \> Gaussian \\
\> Hanning \> Hermite \> Lanczos \\
\> Mitchell \> Point \> Quadratic \\
\> Sinc \>  Triangle \>
\end{tabbing}

If a NULL image is returned, check \texttt{exception} to determine why the
image failed to scale.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[columns] The number of columns in the scaled image.
\item[rows] The number of rows in the scaled image.
\item[filter] Image filter to use.
\item[blur] The blur factor where > 1 is blurry, < 1 is sharp.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{SampleImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*SampleImage(Image \*image, const unsigned int columns, 
  const unsigned int rows, ExceptionInfo \*exception)
\end{quote}

SampleImage() scales an image to the desired dimensions with pixel
sampling.  Unlike other scaling methods, this method does not introduce
any additional color into the scaled image.  If a NULL image is returned,
check \texttt{exception} to determine why the image failed to scale.

A description of each parameter follows:
\begin{description}

\item[image] The image.
\item[columns] The number of columns in the sampled image.
\item[rows] The number of rows in the sampled image.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{ScaleImage()}
scale an image to given dimensions.

\begin{quote}
\hspace*{-0.25in}
Image \*ScaleImage(Image \*image, const unsigned int columns,
   const unsigned int rows, ExceptionInfo \*exception)
\end{quote}

ScaleImage() changes the size of an image to the given dimensions.  If
a NULL image is returned, check \texttt{exception} to determine why the image
failed to scale.

A description of each parameter follows:
\begin{description}
\item[image] The image.
\item[columns] The number of columns in the scaled image.
\item[rows] The number of rows in the scaled image.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\section{Methods to Transform an Image}

\subsubsection{ChopImage()}
chop an image.

\begin{quote}
\hspace*{-0.25in}
Image \*ChopImage(Image \*image, const RectangleInfo \*chop\_info,
  ExceptionInfo \*exception)
\end{quote}

Chop() removes a region of an image and collapses the image to occupy the
removed portion. If a NULL image is returned, check \texttt{exception} to
determine why the operation failed.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[chop\_info] Defines the region of the image to chop with members
\texttt{x}, \texttt{y}, \texttt{width}, and \texttt{height}.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{CoalesceImages()}
coalesce a set of images.

\begin{quote}
\hspace*{-0.25in}
Image \*CoalesceImages(Image \*image, ExceptionInfo \*exception)
\end{quote}

This method composites a set of images while respecting any page
offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
typically start with an image background and each subsequent image
varies in size and offset.  Coalesce() returns a new sequence
where each image in the sequence is the same size as the first and
composited with the next image in the sequence.  On failure, check
\texttt{exception} to determine the reason why the operation failed.

A description of each parameter follows:

\begin{description}
\item[image] The image sequence.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{CropImage()}
crop an image.

\begin{quote}
\hspace*{-0.25in}
Image \*CropImage(Image \*image, const RectangleInfo \*crop\_info, 
  ExceptionInfo \*exception)
\end{quote}

CropImage() extracts a region of the image starting at the offset defined by
\texttt{crop\_info}.  If a NULL image is returned, check
\texttt{exception} to determine the reason why the operation failed.

A description of each parameter follows:
\begin{description}
\item[image] The image.
\item[crop\_info] Defines the region of the image to crop with members
\texttt{x}, \texttt{y}, \texttt{width}, and \texttt{height}.
\item[exception] Return any errors or warnings in this structure.

\end{description}

\subsubsection{DeconstructImages()}
return the constituent parts of an image sequence

\begin{quote}
\hspace*{-0.25in}
Image \*DeconstructImages(Image \*image, ExceptionInfo \*exception)
\end{quote}

DeconstructImages() returns a new sequence that consists of the first image
in the sequence followed by the maximum bounding region of any differences
in subsequent images.  This method can undo a coalesced sequence returned
by CoalesceImages().  If a NULL image is returned, check \texttt{exception}
to determine the reason why the operation failed.

A description of each parameter follows:
\begin{description}
\item[image] The image.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{FlipImage()}
reflect an image vertically.

\begin{quote}
\hspace*{-0.25in}
Image \*FlipImage(Image \*image, ExceptionInfo \*exception)
\end{quote}

FlipImage() creates a vertical mirror image by reflecting the pixels
around the central x-axis.  If a NULL image is returned, check
\texttt{exception} to determine the reason why the operation failed.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{FlopImage()}
reflect an image horizontally.

\begin{quote}
\hspace*{-0.25in}
Image \*FlopImage(Image \*image, ExceptionInfo \*exception)
\end{quote}

FlopImage() creates a horizontal mirror image by reflecting the pixels
around the central y-axis.  If a NULL image is returned, check
\texttt{exception} to determine the reason why the operation failed.

A description of each parameter follows:
\begin{description}
\item[image] The image.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{MosaicImages()}
inlay an image sequence to form a single coherent picture.

\begin{quote}
\hspace*{-0.25in}
Image \*MosaicImages(const Image \*image, ExceptionInfo \*exception)
\end{quote}

The MosaicImages() method takes a set of images and inlays them to form
a single coherent pictiure.  MosaicImages() returns a single image with
each image in the sequence inlayed in the image canvas at an offset as
defined in the image.  If a NULL image is returned, check
\texttt{exception} to determine the reason why the operation failed.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{RollImage()}
offset and roll over an image.

\begin{quote}
\hspace*{-0.25in}
Image \*RollImage(Image \*image, const int x\_offset, const int y\_offset,
   ExceptionInfo \*exception)
\end{quote}

RollImage() offsets an image as defined by \texttt{x} and \texttt{y}.
If a NULL image is returned, check \texttt{exception} to determine the
reason why the operation failed.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[x\_offset] The number of columns to roll in the horizontal direction.
\item[y\_offset] The number of rows to roll in the vertical direction.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{TransformImage()}
resize or crop an image.

\begin{quote}
\hspace*{-0.25in}
void TransformImage(Image \*\*image, const char \*crop\_geometry, 
  const char \*image\_geometry)
\end{quote}

TransformImage() is a convenience method that behaves like ResizeImage() or
CropImage() but accepts scaling and/or cropping information as a region
geometry specification.  If the operation fails, the original image handle
is returned.

A description of each parameter follows:

\begin{description}
\item[image] The image.  The transformed image is returned as this parameter.

\item[crop\_geometry] A crop geometry string.  This geometry defines
a subregion of the image to crop.

\item[image\_geometry] An image geometry string.  This geometry defines
the final size if the image.
\end{description}

\section{Methods to Draw on an Image}

\subsubsection{CloneDrawInfo}
clone a draw info structure.

\begin{quote}
\hspace*{-0.25in}
DrawInfo \*CloneDrawInfo(const ImageInfo \*image\_info,
  const DrawInfo \*draw\_info)
\end{quote}

CloneDrawInfo() makes a copy of the given draw info structure.  If NULL
is specified, a new image info structure is created initialized to
default values.

A description of each parameter follows:

\begin{description}
\item[image\_info] The image info.
\item[draw\_info] The draw info.
\end{description}

\subsubsection{ColorFloodfillImage()}
floodfill the designed area with color.

\begin{quote}
\hspace*{-0.25in}
unsigned int ColorFloodfillImage(Image \*image, const DrawInfo \*draw\_info,
  const PixelPacket target,  const int x\_offset,  const int y\_offset,
  const PaintMethod method)
\end{quote}

ColorFloodfill() changes the color value of any pixel that matches
\texttt{target} and is an immediate neighbor.  If the method is
\texttt{FillToBorderMethod} is specified, the color value is changed
for any neighbor pixel that does not match the \texttt{bordercolor}
member of \texttt{image}.

By default \texttt{target} must match a particular pixel color
exactly.  However, in many cases two colors may differ by a small
amount.  The \texttt{fuzz} member of \texttt{image} defines how much
tolerance is acceptable to consider two colors as the same.  For
example, set fuzz to 10 and the color red at intensities of 100 and 102
respectively are now interpreted as the same color for the purposes of
the floodfill.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[draw\_info] The draw info.
\item[target] The RGB value of the target color.
\item[x, y] The starting location of the operation.
\item[method] Choose either \texttt{FloodfillMethod} or
   \texttt{FillToBorderMethod}.
\end{description}

\subsubsection{DestroyDrawInfo()}
destroy draw info.

\begin{quote}
\hspace*{-0.25in}
void DestroyDrawInfo(DrawInfo \*draw\_info)
\end{quote}

DestroyDrawInfo() deallocates memory associated with an DrawInfo
structure.

A description of each parameter follows:

\begin{description}
\item[draw\_info] The draw info.
\end{description}

\subsubsection{DrawImage}
annotate an image with a graphic primitive.

\begin{quote}
\hspace*{-0.25in}
unsigned int DrawImage(Image \*image, const DrawInfo \*draw\_info)
\end{quote}

Draw() allows you to draw a graphic primitive on your image.  The
primitive may be represented as a string or filename.  Precede the
filename with an ampersand (\texttt{@}) and the contents of the file
are drawn on the image.   You can affect how text is drawn by setting
one or more of these members of the draw info structure:

\begin{description}
\item[primitive]  The primitive describes the type of graphic to draw.
Choose from these primitives:
\begin{tabbing}
0000\=1111111111111111111111111\=22222222222222222222222222\=3333333333333333333333333\kill
\> PointPrimitive \> LinePrimitive  \> RectanglePrimitive \\
\> roundRectanglePrimitive  \> ArcPrimitive  \> EllipsePrimitive \\
\> CirclePrimitive  \> PolylinePrimitive  \> PolygonPrimitive \\
\> BezierPrimitive  \> PathPrimitive  \> ColorPrimitive \\
\> MattePrimitive \> TextPrimitive \> ImagePrimitive
\end{tabbing}
\item[antialias] The visible effect of antialias is to smooth out the
rounded corners of the drawn shape.  Set to 0 to keep crisp edges.
\item[bordercolor] The Color primitive with a method of FloodFill
changes the color value of any pixel that matches \texttt{fill} and is an
immediate neighbor.  If \texttt{bordercolor} is specified, the color
value is changed for any neighbor pixel that is not \texttt{fill}.
\item[density] This parameter sets the vertical and horizontal resolution of
the font.  The default is 72 pixels/inch.
\item[fill] The fill color paints any areas inside the outline of drawn shape.
\item[font] A font can be a Truetype (arial.ttf), Postscript (Helvetica), or a
fully-qualified X11 font (-*-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-*).
\item[geometry] Geometry defines the baseline position where the graphic
primitive is rendered (e.g. +100+50).
\item[method] Primitives Matte and Image behavior depends on the painting
method you choose:

\begin{tabbing}
0000\=1111111111111111\=2222222222222222\=3333333333333333\kill
\> Point \> Replace  \> Floodfull \\
\> FillToBorder \> Reset 
\end{tabbing}
\item[points] List one or more sets of coordinates as required by
the graphic primitive you selected.
\item[pointsize] The font pointsize.  The default is 12.
\item[rotate] Specifies a rotation of \var{rotate-angle} degrees about a given
point. 
\item[scale] Specifies a scale operation by \var{sx} and \var{sy}.
\item[skewX] Specifies a skew transformation along the x-axis.
\item[skewY] Specifies a skew transformation along the y-axis.
\item[stroke] A stroke color paints along the outline of the shape.
\item[stroke\_width] The width of the stroke of the shape.  A zero value
means no stroke is painted.
\item[translate] Specifies a translation by \var{tx} and \var{ty}.
\end{description}


A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[draw\_info] The draw info.
\end{description}

\subsubsection{MatteFloodfillImage()}
floodfill an area with transparency.

\begin{quote}
\hspace*{-0.25in}
unsigned int MatteFloodfillImage(Image \*image, const PixelPacket target,
  const unsigned int opacity, const int x\_offset, const int y\_offset,
  const PaintMethod method)
\end{quote}

MatteFloodfill() changes the transparency value of any pixel that
matches \texttt{target} and is an immediate neighbor.  If the method is
\texttt{FillToBorderMethod} is specified, the transparency value is
changed for any neighbor pixel that does not match the
\texttt{bordercolor} member of \texttt{image}.

By default \texttt{target} must match a particular pixel transparency
exactly.  However, in many cases two transparency values may differ by
a small amount.  The \texttt{fuzz} member of \texttt{image} defines how
much tolerance is acceptable to consider two transparency values as the
same.  For example, set fuzz to 10 and the opacity values of 100 and
102 respectively are now interpreted as the same value for the purposes
of the floodfill.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[target] The RGB value of the target color.
\item[opacity] The level of transparency: 0 is fully opaque and MaxRGB is
fully transparent.
\item[x, y] The starting location of the operation.
\item[method] Choose either \texttt{FloodfillMethod} or
   \texttt{FillToBorderMethod}.
\end{description}

\subsubsection{OpaqueImage}
globally change a color.

\begin{quote}
\hspace*{-0.25in}
unsigned int OpaqueImage(Image \*image, const PixelPacket target, 
  const PixelPacket fill)
\end{quote}

OpaqueImage() changes any pixel that matches \texttt{color} with the
color defined by \texttt{fill}.

By default \texttt{color} must match a particular pixel color exactly.
However, in many cases two colors may differ by a small amount.
\texttt{Fuzz} defines how much tolerance is acceptable to consider two
colors as the same.  For example, set fuzz to 10 and the color red at
intensities of 100 and 102 respectively are now interpreted as the same
color.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[target] The RGB value of the target color.
\item[fill] The replacement color.
\end{description}

\subsubsection{TransparentImage()}
make color transparent.

\begin{quote}
\hspace*{-0.25in}
unsigned int TransparentImage(Image \*image, const PixelPacket target)
\end{quote}

TransparentImage() changes the opacity value associated with any pixel that
matches \texttt{color} to the value defined by \texttt{opacity}.

By default \texttt{color} must match a particular pixel color exactly.
However, in many cases two colors may differ by a small amount.
\texttt{Fuzz} defines how much tolerance is acceptable to consider
two colors as the same.  For example, set fuzz to 10 and the color red
at intensities of 100 and 102 respectively are now interpreted as the
same color.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[target] The RGB value of the target color.
\end{description}

\section{Methods to Annotate an Image}

\subsubsection{AnnotateImage()}


\begin{quote}
\hspace*{-0.25in}
 unsigned int AnnotateImage(Image \*image, DrawInfo \*draw\_info)
\end{quote}

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


A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[draw\_info] The draw info.
\end{description}

\subsubsection{CompressColormap()}

\begin{quote}
\hspace*{-0.25in}
 void CompressColormap(Image \*image)
\end{quote}

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


A description of each parameter follows:
\begin{description}
\item[image] The image.
\end{description}

\subsubsection{GetNumberColors()}

\begin{quote}
\hspace*{-0.25in}
 number\_colors=GetNumberColors(image, file)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[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[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}

\subsubsection{GetTypeMetrics()}

\begin{quote}
\hspace*{-0.25in}
 unsigned int GetTypeMetrics(Image \*image, const DrawInfo
\*draw\_info, FontMetric metrics)
\end{quote}

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

A description of each parameter follows:
\begin{description}

\item[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}

A description of each parameter follows:

\begin{description}

\item[image] The image.
\item[draw\_info] The draw info.
\item[metrics] Method GetTypeMetrics returns the font metrics.
\end{description}

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

\subsubsection{IsGrayImage()}

\begin{quote}
\hspace*{-0.25in}
 unsigned int IsGrayImage(Image \*image)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{IsMonochromeImage()}

\begin{quote}
\hspace*{-0.25in}
 status=IsMonochromeImage(image)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{IsOpaqueImage()}

\begin{quote}
\hspace*{-0.25in}
unsigned int IsOpaqueImage(Image \*image)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{IsPseudoClass()}

\begin{quote}
\hspace*{-0.25in}
 unsigned int IsPseudoClass(Image \*image)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{ListColors}

\begin{quote}
\hspace*{-0.25in}
filelist=ListColors(pattern, number\_colors)
\end{quote}

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

A description of each parameter follows:
\begin{description}
\item[pattern] Specifies a pointer to a text string containing a pattern.
\item[number\_colors] This integer returns the number of colors in the list.
\end{description}

\subsubsection{QueryColorDatabase()}

\begin{quote}
\hspace*{-0.25in}
 unsigned int QueryColorDatabase(const char \*target, PixelPacket
\*color)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[target] Specifies the color to lookup in the X color database.
\item[color] A pointer to an PixelPacket structure.  The RGB value of the target
color is returned as this value.
\end{description}

\subsubsection{QueryColorName()}

\begin{quote}
\hspace*{-0.25in}
unsigned int QueryColorName(const PixelPacket \*color, char \*name)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[distance] Method QueryColorName returns the distance-squared in RGB space
as well as the color name that is at a minimum distance.
\item[color] This is a pointer to a PixelPacket structure that contains the
color we are searching for.
\item[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}

\subsubsection{BorderImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*BorderImage(const Image \*image, const RectangleInfo \*border\_info,
  ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[border\_info] Specifies a pointer to a structure of type Rectangle which
defines the border region.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{FrameImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*FrameImage(Image \*image, const FrameInfo \*frame\_info, 
  ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[frame\_info] Specifies a pointer to a FrameInfo structure which defines
the framed region.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{RaiseImage()}

\begin{quote}
\hspace*{-0.25in}
unsigned int RaiseImage(Image \*image, const RectangleInfo \*raise\_info,
  const int raised)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[raise\_info] Specifies a pointer to a XRectangle which defines the raised
region.
\item[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}

\subsubsection{CloneMontageInfo()}

\begin{quote}
\hspace*{-0.25in}
MontageInfo \*CloneMontageInfo(const ImageInfo \*image\_info, 
  const MontageInfo \*montage\_info)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image\_info] The image info.
\item[montage\_info] The montage info.
\end{description}

\subsubsection{DestroyMontageInfo()}

\begin{quote}
\hspace*{-0.25in}
 void DestroyMontageInfo(MontageInfo \*montage\_info)
\end{quote}

Method DestroyMontageInfo deallocates memory associated with an
MontageInfo structure.

A description of each parameter follows:

\begin{description}
\item[montage\_info] The montage info.
\end{description}

\subsubsection{GetMontageInfo()}

\begin{quote}
\hspace*{-0.25in}
void GetMontageInfo(const ImageInfo \*image\_info, MontageInfo \*montage\_info)
\end{quote}

Method GetMontageInfo initializes the MontageInfo structure.

A description of each parameter follows:

\begin{description}
\item[image\_info] The image info.
\item[montage\_info] The montage info.
\end{description}

\subsubsection{MontageImages()}

\begin{quote}
\hspace*{-0.25in}
Image \*MontageImages(Image \*image, const MontageInfo \*montage\_info,
  ExceptionInfo \*exception)
\end{quote}

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

A description of each parameter follows:

\begin{description}

\item[image] The image.
\item[montage\_info] The montage info.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\section{ImageMagick Image Effects Methods}

\subsubsection{AddNoiseImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*AddNoiseImage(Image \*image, const NoiseType noise\_type, 
ExceptionInfo \*exception)
\end{quote}


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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[noise\_type] The type of noise: Gaussian, multiplicative Gaussian,
  impulse,  laplacian, or Poisson.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{BlurImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*BlurImage(Image \*image, const double radius,  const double
sigma, ExceptionInfo \*exception)
\end{quote}

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 method 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.

A description of each parameter follows:
\begin{description}
\item[radius] The radius of the Gaussian, in pixels,  not counting the center
pixel.
\item[sigma] The standard deviation of the Gaussian, in pixels.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{ColorizeImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*ColorizeImage(Image \*image, const char \*opacity,  const
PixelPacket target, ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}

\item[image] The image.
\item[opacity] A character string indicating the level of opacity as a
percentage (0-0.5).
\item[target] A color value.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{ConvolveImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*ConvolveImage(Image \*image, const unsigned int order, 
const double \*kernel, ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[order] The number of columns and rows in the filter kernel.
\item[kernel] An array of double representing the convolution kernel.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{DespeckleImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*DespeckleImage(Image \*image, ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{EdgeImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*EdgeImage(Image \*image, const double radius,  ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image]  The image.
\item[radius] the radius of the pixel neighborhood.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{EmbossImage}

\begin{quote}
\hspace*{-0.25in}
Image \*EmbossImage(Image \*image, const double radius,  const double sigma,
  ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[radius] the radius of the pixel neighborhood.
\item[sigma] The standard deviation of the Gaussian, in pixels.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{EnhanceImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*EnhanceImage(Image \*image, ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{GaussianBlurImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*GaussianBlurImage(Image \*image, const double radius, const double sigma,
  ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:
\begin{description}
\item[image] The image.
\item[radius] the radius of the Gaussian, in pixels,  not counting the
  center pixel.
\item[sigma] the standard deviation of the Gaussian, in pixels.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{ImplodeImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*ImplodeImage(Image \*image, const double factor, 
  ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[factor] A double value that defines the extent of the implosion.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{MedianFilterImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*MedianFilterImage(Image \*image, const double radius, 
  ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}

\item[image]  The image.
\item[radius] the radius of the pixel neighborhood.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{MorphImages()}

\begin{quote}
\hspace*{-0.25in}
Image \*MorphImages(Image \*image, const unsigned int number\_frames,
  ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[number\_frames] This unsigned integer reflects the number of in-between
image to generate.  The more in-between frames, the smoother the morph.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{OilPaintImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*OilPaintImage(Image \*image, const double radius, 
ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[radius] The radius of the circular neighborhood.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{PlasmaImage()}

\begin{quote}
\hspace*{-0.25in}
 unsigned int PlasmaImage(Image \*image, const SegmentInfo \*segment, 
int attenuate, int depth)
\end{quote}

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.

A description of each parameter follows:

\begin{description}

\item[image] The image.
\item[segment] specifies a structure of type SegmentInfo that defines the
boundaries of the area where the plasma fractals are applied.
\item[attenuate] specifies the plasma attenuation factor.
\item[depth] this integer values define the plasma recursion depth.
\end{description}

\subsubsection{ReduceNoiseImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*ReduceNoiseImage(Image \*image, const double,  ExceptionInfo
\*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] the image.
\item[radius] the radius of the pixel neighborhood.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{ShadeImage}

\begin{quote}
\hspace*{-0.25in}
Image \*ShadeImage(Image \*image, const unsigned int color\_shading, 
  double azimuth, double elevation,  ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[color\_shading] A value other than zero shades the red, green,  and blue
components of the image.
\item[azimuth, elevation] A double value that indicates the light source
direction.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{SharpenImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*SharpenImage(Image \*image, const double radius,  const double sigma,
  ExceptionInfo \*exception)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[radius] The radius of the Gaussian, in pixels,  not counting the center
pixel.
\item[sigma] The standard deviation of the Laplacian, in pixels.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{SolarizeImage()}

\begin{quote}
\hspace*{-0.25in}
void SolarizeImage(Image \*image, const double factor)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[factor] An double value that defines the extent of the solarization.
\end{description}

\subsubsection{SpreadImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*SpreadImage(Image \*image, const unsigned int amount, 
  ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[amount] An unsigned value constraining the "vicinity" for choosing a
random pixel to swap.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{SteganoImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*SteganoImage(Image \*image, Image \*watermark,  ExceptionInfo \*exception)
\end{quote}

Method SteganoImage hides a digital watermark within the image.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[watermark] The image.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{StereoImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*StereoImage(Image \*image, Image \*offset\_image, 
  ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[offset\_image] The image.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{SwirlImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*SwirlImage(Image \*image, double degrees,  ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[degrees] An double value that defines the tightness of the swirling.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{ThresholdImage()}

\begin{quote}
\hspace*{-0.25in}
unsigned int ThresholdImage(Image \*image, const double threshold)
\end{quote}

Method ThresholdImage thresholds the reference image.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[threshold] A double indicating the threshold value.
\end{description}

\subsubsection{UnsharpMaskImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*UnsharpMaskImage(Image \*image, const double radius,  const double sigma,
  const double amount,  const double threshold,  ExceptionInfo \*exception)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[radius] The radius of the Gaussian, in pixels,  not counting the center
pixel.
\item[sigma] The standard deviation of the Gaussian, in pixels.
\item[amount] The percentage of the difference between the original and the blur
image that is added back into the original.
\item[threshold] The threshold in pixels needed to apply the diffence amount.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{WaveImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*WaveImage(Image \*image, const double amplitude,
  const double wave\_length, ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image returned from ReadImage.
\item[amplitude, frequency] A double value that indicates the amplitude and
wavelength of the sine wave.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\section{Methods to Enhance an Image}

\subsubsection{ContrastImage()}

\begin{quote}
\hspace*{-0.25in}
unsigned int ContrastImage(Image \*image, const unsigned int sharpen)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[sharpen] If True, the intensity is increased otherwise it is decreased.
\end{description}

\subsubsection{EqualizeImage()}

\begin{quote}
\hspace*{-0.25in}
unsigned int EqualizeImage(Image \*image)
\end{quote}

Method EqualizeImage performs histogram equalization on the reference
image.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{GammaImage()}

\begin{quote}
\hspace*{-0.25in}
unsigned int GammaImage(Image \*image, const char \*gamma)
\end{quote}

Method GammaImage converts the reference image to gamma corrected colors.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[gamma] A character string indicating the level of gamma correction.
\end{description}

\subsubsection{ModulateImage()}

\begin{quote}
\hspace*{-0.25in}
unsigned int ModulateImage(Image \*image, const char \*modulate)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[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}

\subsubsection{MotionBlurImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*MotionBlurImage(Image \*image, const double radius, const double sigma,
  ExceptionInfo \*exception)
\end{quote}

Method MotionBlurImage 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.

A description of each parameter follows:

\begin{description}
\item[image]  The image.
\item[radius] the radius of the Motion, in pixels,  not counting the center pixel.
\item[sigma] the standard deviation of the Motion, in pixels.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{NegateImage()}

\begin{quote}
\hspace*{-0.25in}
unsigned int NegateImage(Image \*image, const unsigned int grayscale)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{NormalizeImage()}

\begin{quote}
\hspace*{-0.25in}
unsigned int NormalizeImage(Image \*image)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

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

\subsubsection{CloneQuantizeInfo()}

\begin{quote}
\hspace*{-0.25in}
QuantizeInfo \*CloneQuantizeInfo(const QuantizeInfo \*quantize\_info)
\end{quote}

Method CloneQuantizeInfo makes a duplicate of the given quantize info
structure, or if quantize info is NULL,  a new one.
A description of each parameter follows:

\begin{description}
\item[quantize\_info] a structure of type info.
\end{description}

\subsubsection{DestroyQuantizeInfo()}

\begin{quote}
\hspace*{-0.25in}
DestroyQuantizeInfo(QuantizeInfo \*quantize\_info)
\end{quote}

Method DestroyQuantizeInfo deallocates memory associated with an
QuantizeInfo structure.

A description of each parameter follows:

\begin{description}
\item[quantize\_info] Specifies a pointer to an QuantizeInfo structure.
\end{description}

\subsubsection{GetQuantizeInfo()}

\begin{quote}
\hspace*{-0.25in}
GetQuantizeInfo(QuantizeInfo \*quantize\_info)
\end{quote}

Method GetQuantizeInfo initializes the QuantizeInfo structure.

A description of each parameter follows:

\begin{description}
\item[quantize\_info] Specifies a pointer to a QuantizeInfo structure.
\end{description}

\subsubsection{MapImage()}

\begin{quote}
\hspace*{-0.25in}
unsigned int MapImage(Image \*image, Image \*map\_image,
  const unsigned int dither)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[map\_image] Specifies a pointer to a Image structure.  Reduce image to a
set of colors represented by this image.
\item[dither] Set this integer value to something other than zero to dither the
quantized image.
\end{description}

\subsubsection{MapImages()}

\begin{quote}
\hspace*{-0.25in}
unsigned int MapImages(Image \*images, Image \*map\_image, 
  const unsigned int dither)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[map\_image] Specifies a pointer to a Image structure.  Reduce image to a
set of colors represented by this image.
\item[dither] Set this integer value to something other than zero to dither
the quantized image.
\end{description}

\subsubsection{QuantizationError()}

\begin{quote}
\hspace*{-0.25in}
unsigned int QuantizationError(Image \*image)
\end{quote}

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:

A description of each parameter follows:

\begin{description}

\item[mean\_error\_per\_pixel]

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

\item[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[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}

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{QuantizeImage()}

\begin{quote}
\hspace*{-0.25in}
unsigned int QuantizeImage(const QuantizeInfo \*quantize\_info, Image \*image)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[quantize\_info] Specifies a pointer to an QuantizeInfo structure.
\item[image] Specifies a pointer to a Image structure.
\end{description}

\subsubsection{QuantizeImages()}

\begin{quote}
\hspace*{-0.25in}
unsigned int QuantizeImages(const QuantizeInfo \*quantize\_info, Image \*images)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[quantize\_info] Specifies a pointer to an QuantizeInfo structure.
\item[images] Specifies a pointer to a list of Image structures.
\end{description}

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

\subsubsection{SegmentImage()}

\begin{quote}
\hspace*{-0.25in}
unsigned int SegmentImage(Image \*image, const ColorspaceType colorspace,
  const unsigned int verbose,  const double cluster\_threshold, 
  const double smoothing\_threshold)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] Specifies a pointer to an Image structure returned from ReadImage.
\item[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[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}

\subsubsection{RotateImage}

\begin{quote}
\hspace*{-0.25in}
Image \*RotateImage(Image \*image, const double degrees,
  ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[degrees] Specifies the number of degrees to rotate the image.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{ShaveImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*ShaveImage(const Image \*image, const RectangleInfo \*shave\_info,
  ExceptionInfo \*exception)
\end{quote}

Method ShaveImage shaves pixels from the image edges.
It allocates the memory necessary for the new Image
structure and returns a pointer to the new image.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[shave\_info] Specifies a pointer to a structure of type Rectangle which
defines the shave region.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{ShearImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*ShearImage(Image \*image, const double x\_shear,  const double y\_shear,
  ExceptionInfo \*exception)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[x\_shear, y\_shear] Specifies the number of degrees to shear the image.
\item[exception] Return any errors or warnings in this structure.
\end{description}

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

\subsubsection{SignatureImage()}

\begin{quote}
\hspace*{-0.25in}
unsigned int SignatureImage(Image \*image)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\section{Image Pixel FIFO}

\subsubsection{ReadStream()}

\begin{quote}
\hspace*{-0.25in}
unsigned int ReadStream(const ImageInfo \*image\_info,
  void (\*Stream)(const Image \*, const void \*,  const size\_t),
  ExceptionInfo \*exception)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image\_info] Specifies a pointer to an ImageInfo structure.
\item[stream] a callback method.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{WriteStream()}

\begin{quote}
\hspace*{-0.25in}
unsigned int WriteStream(const ImageInfo \*image\_info,
  Image \*, int(\*Stream) (const Image \*, const void \*, const size\_t))
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image\_info] Specifies a pointer to an ImageInfo structure.
\item[stream] a callback method.
\end{description}

\section{Image Text Attributes Methods}

\subsubsection{DestroyImageAttributes()}

\begin{quote}
\hspace*{-0.25in}
DestroyImageAttributes(Image \*image)
\end{quote}

Method DestroyImageAttributes deallocates memory associated with the
image attribute list.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{GetImageAttribute()}

\begin{quote}
\hspace*{-0.25in}
ImageAttribute \*GetImageAttribute(const Image \*image, const char \*key)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[key] These character strings are the name of an image attribute to return.
\end{description}

\subsubsection{GetImageInfoAttribute()}

\begin{quote}
\hspace*{-0.25in}
ImageAttribute \*GetImageAttribute(const Image \*image, const char \*key)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image\_info] The imageInfo.
\item[image] The image.
\item[key] These character strings are the name of an image attribute to return.
\end{description}

\subsubsection{SetImageAttribute()}

\begin{quote}
\hspace*{-0.25in}
unsigned int SetImageAttribute(Image \*image, const char \*key,
  const char \*value)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[key, value] These character strings are the name and value of an image
attribute to replace or add to the list.
\end{description}

\subsubsection{StoreImageAttribute()}

\begin{quote}
\hspace*{-0.25in}
StoreImageAttribute(Image \*image, char \*text)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[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}

\subsubsection{ClosePixelCache()}

\begin{quote}
\hspace*{-0.25in}
void ClosePixelCache(Image \*image)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{DestroyPixelCache()}

\begin{quote}
\hspace*{-0.25in}
void DestroyPixelCache(Image \*image)
\end{quote}

Method DestroyPixelCache deallocates memory associated with the pixel
cache.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{GetIndexesFromCache()}

\begin{quote}
\hspace*{-0.25in}
IndexPacket \*GetIndexesFromCache(const Image \*image)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{GetOnePixelFromCache()}

\begin{quote}
\hspace*{-0.25in}
PixelPacket \*GetOnePixelFromCache(const Image image, const int x, const int y)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[x, y] These values define the location of the pixel to return.
\end{description}

\subsubsection{GetPixelCache()}

\begin{quote}
\hspace*{-0.25in}
PixelPacket \*GetPixelCache(Image \*image, const int x,  const int y, 
  const unsigned int columns, const unsigned int rows)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[x, y, columns, rows] These values define the perimeter of a region of
pixels.
\end{description}

\subsubsection{GetPixelsFromCache()}

\begin{quote}
\hspace*{-0.25in}
PixelPacket \*GetPixelsFromCache(const Image image)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{SetPixelCache()}

\begin{quote}
\hspace*{-0.25in}
PixelPacket \*SetPixelCache(Image \*image, const int x,  const int y, 
  const unsigned int columns, const unsigned int rows)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\item[x, y, columns, rows] These values define the perimeter of a region of
pixels.
\end{description}

\subsubsection{SyncPixelCache()}

\begin{quote}
\hspace*{-0.25in}
unsigned int SyncPixelCache(Image \*image)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\subsubsection{WriteCacheInfo()}

\begin{quote}
\hspace*{-0.25in}
unsigned int WriteCacheInfo(Image \*image)
\end{quote}

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


A description of each parameter follows:

\begin{description}
\item[image] The image.
\end{description}

\section{Methods to Read or Write Binary Large Objects}

\subsubsection{BlobToImage()}

\begin{quote}
\hspace*{-0.25in}
Image \*BlobToImage(const ImageInfo \*image\_info, const void
\*blob, const size\_t length,  ExceptionInfo \*exception)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image\_info] Specifies a pointer to an ImageInfo structure.
\item[blob] The address of a character stream in one of the image formats
understood by ImageMagick.
\item[length] This size\_t integer reflects the length in bytes of the blob.
\item[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{DestroyBlobInfo()}

\begin{quote}
\hspace*{-0.25in}
 void DestroyBlobInfo(BlobInfo \*blob)
\end{quote}

Method DestroyBlobInfo deallocates memory associated with an BlobInfo
structure.

A description of each parameter follows:

\begin{description}
\item[blob] Specifies a pointer to a BlobInfo structure.
\end{description}

\subsubsection{GetBlobInfo()}

\begin{quote}
\hspace*{-0.25in}
void GetBlobInfo(BlobInfo \*blob)
\end{quote}

Method GetBlobInfo initializes the BlobInfo structure.

A description of each parameter follows:

\begin{description}
\item[blob] Specifies a pointer to a BlobInfo structure.
\end{description}

\subsubsection{ImageToBlob()}

\begin{quote}
\hspace*{-0.25in}
void \*ImageToBlob(const ImageInfo \*image\_info, Image \*image,
  size\_t \*length, ExceptionInfo \*exception)
\end{quote}

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.).

A description of each parameter follows:

\begin{description}
\item[image\_info] Specifies a pointer to an ImageInfo structure.
\item[image] The image.
\item[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[exception] Return any errors or warnings in this structure.
\end{description}

\subsubsection{SetBlobQuantum()}

\begin{quote}
\hspace*{-0.25in}
void SetBlobQuantum(BlobInfo \*blob, const size\_t quantum)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[blob] A pointer to a BlobInfo structure.
\item[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}

\subsubsection{DestroyMagickInfo()}

\begin{quote}
\hspace*{-0.25in}
void DestroyMagickInfo()
\end{quote}

Method DestroyMagickInfo deallocates memory associated MagickInfo list.

\subsubsection{GetImageMagick()}

\begin{quote}
\hspace*{-0.25in}
char \*GetImageMagick(const unsigned char \*magick, const unsigned int length)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[magick] a character string that represents the image format we are looking
for.
\item[length] The length of the binary string.
\end{description}

\subsubsection{GetMagickConfigurePath()}

\begin{quote}
\hspace*{-0.25in}
char \*GetMagickConfigurePath(const char \*filename)
\end{quote}

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


A description of each parameter follows:

\begin{description}
\item[filename] A character string representing the desired configuration file.
\end{description}

\subsubsection{GetMagickInfo()}

\begin{quote}
\hspace*{-0.25in}
MagickInfo \*GetMagickInfo(const char \*tag)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[tag] a character string that represents the image format we are looking for.
\end{description}

\subsubsection{GetMagickVersion()}

\begin{quote}
\hspace*{-0.25in}
 char \*GetMagickVersion(unsigned int \*version)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[version] The ImageMagick version is returned as a number.
\end{description}

\subsubsection{ListMagickInfo()}

\begin{quote}
\hspace*{-0.25in}
 void ListMagickInfo(FILE \*file)
\end{quote}

Method ListMagickInfo lists the image formats to a file.

A description of each parameter follows:

\begin{description}
\item[file] A pointer to a FILE structure.
\end{description}

\subsubsection{MagickIncarnate()}

\begin{quote}
\hspace*{-0.25in}
MagickIncarnate(const char \*path)
\end{quote}

Method MagickIncarnate initializes the ImageMagick environment.

A description of each parameter follows:

\begin{description}
\item[path] Specifies a pointer to the execution path of the current ImageMagick
client.
\end{description}

\subsubsection{RegisterMagickInfo()}

\begin{quote}
\hspace*{-0.25in}
MagickInfo \*RegisterMagickInfo(MagickInfo \*entry)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[entry] A pointer to a structure of type MagickInfo.
\end{description}

\subsubsection{SetMagickInfo()}

\begin{quote}
\hspace*{-0.25in}
MagickInfo \*SetMagickInfo(const char \*tag)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[tag] a character string that represents the image format associated with the
MagickInfo structure.
\end{description}

\subsubsection{UnregisterMagickInfo()}

\begin{quote}
\hspace*{-0.25in}
unsigned int UnregisterMagickInfo(const char \*tag)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[tag] a character string that represents the image format we are looking for.
\end{description}

\section{ImageMagick Error Methods}

\subsubsection{CatchImageException()}

\begin{quote}
\hspace*{-0.25in}
CatchImageException(Image \*image)
\end{quote}

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.

A description of each parameter follows:

\begin{description}
\item[image] Specifies a pointer to a list of one or more images.
\end{description}

\subsubsection{DestroyExceptionInfo()}

\begin{quote}
\hspace*{-0.25in}
void DestroyExceptionInfo(ExceptionInfo \*exception)
\end{quote}

Method DestroyExceptionInfo deallocates memory associated with an
ExceptionInfo structure.

A description of each parameter follows:

\begin{description}
\item[exception] Specifies a pointer to an ExceptionInfo structure.
\end{description}

\subsubsection{GetExceptionInfo}

\begin{quote}
\hspace*{-0.25in}
GetExceptionInfo(ExceptionInfo \*exception)
\end{quote}

Method GetExceptionInfo initializes the ExceptionInfo structure.

A description of each parameter follows:

\begin{description}
\item[error\_info] Specifies a pointer to a ExceptionInfo structure.
\end{description}

\subsubsection{GetImageException()}

\begin{quote}
\hspace*{-0.25in}
GetImageException(Image \*image, ExceptionInfo \*exception)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[image] Specifies a pointer to a list of one or more images.
\item[exception] return the highest severity exception.
\end{description}

\subsubsection{MagickError()}

\begin{quote}
\hspace*{-0.25in}
void MagickError(const ExceptionType error, const char \*reason, 
  const char \*description)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[exception] Specifies the numeric error category.
\item[reason] Specifies the reason to display before terminating the program.
\item[description] Specifies any description to the reason.
\end{description}

\subsubsection{MagickWarning()}

\begin{quote}
\hspace*{-0.25in}
void MagickWarning(const ExceptionType warning, const char \*reason, 
  const char \*description)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[warning] Specifies the numeric warning category.
\item[reason] Specifies the reason to display before terminating the program.
\item[description] Specifies any description to the reason.
\end{description}

\subsubsection{SetErrorHandler()}

\begin{quote}
\hspace*{-0.25in}
ErrorHandler SetErrorHandler(ErrorHandler handler)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[handler] Specifies a pointer to a method to handle errors.
\end{description}

\subsubsection{SetWarningHandler()}

\begin{quote}
\hspace*{-0.25in}
ErrorHandler SetWarningHandler(ErrorHandler handler)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[handler] Specifies a pointer to a method to handle warnings.
\end{description}

\subsubsection{ThrowException()}

\begin{quote}
\hspace*{-0.25in}
void ThrowException(ExceptionInfo \*exception, const ExceptionType severity,
  const char \*reason,  const char \*description)
\end{quote}

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

A description of each parameter follows:

\begin{description}
\item[exception] Specifies a pointer to the ExceptionInfo structure.
\item[severity] This ExceptionType declares the severity of the exception.
\item[reason] Specifies the reason to display before terminating the program.
\item[description] Specifies any description to the reason.
\end{description}

\section{ImageMagick Memory Allocation Methods}

\subsubsection{AcquireMemory}

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



\begin{quote}
\hspace*{-0.25in}
 void \*AcquireMemory(const size\_t size)
\end{quote}


A description of each parameter follows:
\begin{description}

\item[memory]

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

\item[size]

Specifies the size of the memory to return.

\end{description}

\subsubsection{LiberateMemory}

Method LiberateMemory frees memory that has already been allocated.



\begin{quote}
\hspace*{-0.25in}
 void LiberateMemory(void \*\*memory)
\end{quote}


A description of each parameter follows:
\begin{description}

\item[span]

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

\end{description}

\subsubsection{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.



\begin{quote}
\hspace*{-0.25in}
 void ReacquireMemory(void \*\*memory, const size\_t size)
\end{quote}


A description of each parameter follows:
\begin{description}

\item[memory]

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

\item[size]

Specifies the size of the memory to return.

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

\subsubsection{MagickMonitor}

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



\begin{quote}
\hspace*{-0.25in}
 void MagickMonitor(const char \*text, const off\_t quantum,  const
off\_t span)
\end{quote}


A description of each parameter follows:
\begin{description}

\item[quantum]

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

\item[span]

Specifies the span relative to completing a task.

\end{description}

\subsubsection{SetMonitorHandler}

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



\begin{quote}
\hspace*{-0.25in}
 MonitorHandler SetMonitorHandler(MonitorHandler handler)
\end{quote}


A description of each parameter follows:
\begin{description}

\item[handler]

Specifies a pointer to a method to handle monitors.

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

\subsubsection{XAnimateBackgroundImage}

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



\begin{quote}
\hspace*{-0.25in}
 void XAnimateBackgroundImage(Display \*display, XResourceInfo
\*resource\_info, Image \*image)
\end{quote}


A description of each parameter follows:
\begin{description}

\item[display]

Specifies a connection to an X server returned from XOpenDisplay.

\item[resource\_info]

Specifies a pointer to a X11 XResourceInfo structure.

\item[image]

Specifies a pointer to a Image structure returned from ReadImage.

\end{description}

\subsubsection{XAnimateImage}

Method XAnimateImages displays an image via X11.



\begin{quote}
\hspace*{-0.25in}
Image \*XAnimateImages(Display \*display, XResourceInfo \*resource\_info, 
  char \*\*argv, const int argc, Image \*image)
\end{quote}


A description of each parameter follows:
\begin{description}

\item[display]

Specifies a connection to an X server returned from XOpenDisplay.

\item[resource\_info]

Specifies a pointer to a X11 XResourceInfo structure.

\item[argv]

Specifies the application's argument list.

\item[argc]

Specifies the number of arguments.

\item[image]

Specifies a pointer to a Image structure returned from ReadImage.

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

\subsubsection{XDisplayBackgroundImage}

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



\begin{quote}
\hspace*{-0.25in}
 unsigned int XDisplayBackgroundImage(Display \*display, 
XResourceInfo \*resource\_info, Image \*image)
\end{quote}


A description of each parameter follows:
\begin{description}

\item[status]

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

\item[display]

Specifies a connection to an X server returned from XOpenDisplay.

\item[resource\_info]

Specifies a pointer to a X11 XResourceInfo structure.

\item[image]

Specifies a pointer to a Image structure returned from ReadImage.

\end{description}

\subsubsection{XDisplayImage}

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



\begin{quote}
\hspace*{-0.25in}
Image \*XDisplayImage(Display \*display, XResourceInfo
\*resource\_info, char \*\*argv,  int argc,  Image \*\*image,  unsigned
long \*state)
\end{quote}


A description of each parameter follows:
\begin{description}

\item[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[display]

Specifies a connection to an X server returned from XOpenDisplay.

\item[resource\_info]

Specifies a pointer to a X11 XResourceInfo structure.

\item[argv]

Specifies the application's argument list.

\item[argc]

Specifies the number of arguments.

\item[image]

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

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

\subsubsection{CloseCacheView}

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



\begin{quote}
\hspace*{-0.25in}
 void CloseCacheView(ViewInfo \*view)
\end{quote}


A description of each parameter follows:
\begin{description}

\item[view]

The address of a structure of type ViewInfo.

\end{description}

\subsubsection{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.



\begin{quote}
\hspace*{-0.25in}
 PixelPacket \*GetCacheView(ViewInfo \*view, const int x,  const
int y, const unsigned int columns,  const unsigned int rows)
\end{quote}


A description of each parameter follows:
\begin{description}

\item[pixels]

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

\item[view]

The address of a structure of type ViewInfo.

\item[x, y, columns, rows]

These values define the perimeter of a region of pixels.

\end{description}

\subsubsection{GetCacheViewIndexes}

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



\begin{quote}
\hspace*{-0.25in}
 IndexPacket \*GetCacheViewIndexes(const ViewInfo \*view)
\end{quote}


A description of each parameter follows:
\begin{description}

\item[indexes]

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

\item[view]

The address of a structure of type ViewInfo.

\end{description}

\subsubsection{GetCacheViewPixels}

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



\begin{quote}
\hspace*{-0.25in}
 PixelPacket \*GetCacheViewPixels(const ViewInfo \*view)
\end{quote}


A description of each parameter follows:
\begin{description}

\item[pixels]

Method GetCacheViewPixels returns the pixels associated with the
specified view.

\item[view]

The address of a structure of type ViewInfo.

\end{description}

\subsubsection{OpenCacheView}

Method OpenCacheView opens a view into the pixel cache.



\begin{quote}
\hspace*{-0.25in}
 ViewInfo \*OpenCacheView(Image \*image)
\end{quote}


A description of each parameter follows:
\begin{description}

\item[image]

The image.

\end{description}

\subsubsection{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.



\begin{quote}
\hspace*{-0.25in}
 PixelPacket \*SetCacheView(ViewInfo \*view, const int x,  const
int y, const unsigned int columns,  const unsigned int rows)
\end{quote}


A description of each parameter follows:
\begin{description}

\item[pixels]

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

\item[view]

The address of a structure of type ViewInfo.

\item[x, y, columns, rows]

These values define the perimeter of a region of pixels.

\end{description}

\subsubsection{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.



\begin{quote}
\hspace*{-0.25in}
 unsigned int SyncCacheView(ViewInfo \*view)
\end{quote}


A description of each parameter follows:
\begin{description}

\item[status]

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

\item[view]

The address of a structure of type ViewInfo.

\end{description}

\section{API Structures}
\subsubsection{AffineMatrix}
The members of the AffineMatrix structure are shown in the following table:

\begin{longtable}{llp{9cm}}
\caption{ColorPacket Structure} \\[0.5in]
\multicolumn{3}{c}{Matrix Structure}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endfirsthead
\multicolumn{3}{c}{Matrix Structure(continued)}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endhead
sx & \var{double} & x scale. \\
sy & \var{double} & y scale. \\
rx & \var{double} & x rotate. \\
ry & \var{double} & y rotate. \\
tx & \var{double} & x translate. \\
ty & \var{double} & y translate. \\
\end{longtable}

\subsubsection{ColorPacket}
The ColorPacket structure is used to represent color options as well as
the color palette for PseudoColor images in ImageMagick.

The members of the ColorPacket structure are shown in the following table:

\begin{longtable}{llp{9cm}}
\caption{ColorPacket Structure} \\[0.5in]
\multicolumn{3}{c}{ColorPacket Structure}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endfirsthead
\multicolumn{3}{c}{ColorPacket Structure(continued)}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endhead
red & \var{unsigned short} & red. \\
green & \var{unsigned short} & green. \\
blue & \var{unsigned short} & blue. \\
index & \var{unsigned short} & index. \\
\end{longtable}

\subsubsection{DrawInfo}
The DrawInfo structure is used to support annotating an image using
drawing commands.

The members of the DrawInfo structure are shown in the following
table. The structure is initialized to reasonable defaults by first
initializing the equivalent members of ImageInfo, and then initializing
the entire structure using GetDrawInfo().


\begin{longtable}{llp{9cm}}
\caption{DrawInfo Structure} \\[0.5in]
\multicolumn{3}{c}{DrawInfo Structure}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endfirsthead
\multicolumn{3}{c}{DrawInfo Structure(continued)}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endhead
affine & \var{AffineMatrix} & Coordinate transformation(rotation, scaling,  and
 translation). \\
border\_color & \var{PixelPacket} & Border color. \\
box & \var{PixelPacket} & Text solid background color. \\
decorate & \var{DecorationType} & Text decoration type. \\
density & \var{char *} &  Text rendering density in DPI(effects scaling font
according to pointsize). E.g. "72x72". \\
fill & \var{PixelPacket}  & Object internal fill(within outline) color.\\
font & \var{char *} & Font to use when rendering text. \\
gravity & \var{GravityType} &  Text placement preference(e.g.
 NorthWestGravity). \\
linewidth & \var{double} &  Stroke(outline) drawing width in pixels. \\
pointsize & \var{double} & Font size(also see density).\\
primitive & \var{char *} & Space or new-line delimited list of text drawing
primitives(e.g "text 100, 100 Cockatoo"). See the table Drawing Primitives for
the available drawing primitives. \\
stroke & PixelPacket & Object stroke(outline) color. \\
stroke\_antialias & \var{unsigned int} & Set to True(non-zero) to obtain
anti-aliased stroke rendering. \\
text\_antialias & \var{unsigned int}  & Set to True(non-zero) to obtain
anti-aliased text rendering. \\
tile & \var{Image *} & Image texture to draw with. Use an image containing a
single color(e.g. a 1x1 image) to draw in a solid color. \\
\end{longtable}

\subsubsection{ExceptionInfo}

\index{ExceptionInfo}
The members of the ExceptionInfo structure are shown in the following
table:

\begin{longtable}{llp{9cm}}
\caption{ImageInfo Structure} \\[0.5in]
\multicolumn{3}{c}{ExceptionInfo Structure}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endfirsthead
\multicolumn{3}{c}{ImageInfo Structure(continued)}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endhead
severity & \var{ExceptionType} & warning or error severity. \\
reason & \var{char *} & warning or error message. \\
description & \var{char *} & warning or error description. \\
\end{longtable}

\subsubsection{Image}
The \var{Image} structure represents an ImageMagick image. It is initially
allocated by AllocateImage() and deallocated by DestroyImage(). The
functions ReadImage(), ReadImages(),  BlobToImage() and CreateImage()
return a new image. Use CloneImage() to copy an image. An image consists
of a structure containing image attributes as well as the image pixels.

The image pixels are represented by the structure PixelPacket and
are cached in-memory, or on disk,  depending on the cache threshold
setting. This cache is known as the "pixel cache". Pixels in the cache may
not be edited directly. They must first be made visible from the cache
via a pixel view. A pixel view is a rectangular view of the pixels as
defined by a starting coordinate, and a number of rows and columns. When
considering the varying abilities of multiple platforms, the most reliably
efficient pixel view is comprized of part, or all,  of one image row.

There are two means of accessing pixel views.  When using the
default view, the pixels are made visible and accessable by using the
GetImagePixels() method which provides access to a specified region of
the image. After the view has been updated, thhe pixels may be saved back
to the cache in their original positions via SyncImagePixels(). In order
to create an image with new contents, or to blindly overwrite existing
contents, the method  SetImagePixels() is used to reserve a pixel view
corresponding to a region in the pixel cache. Once the pixel view has
been updated, it may be written to the cache via SyncImagePixels(). The
function GetIndexes() provides access to the image colormap, represented
as an array of type IndexPacket.

A more flexible interface to the image pixels is via the CacheView
interface. This interface supports multiple pixel cache views(limited
by the number of image rows), each of which are identified by a handle
(of type ViewInfo*). Use OpenCacheView() to obtain a new cache view, 
CloseCacheView() to discard a cache view, GetCacheView() to access an
existing pixel region, SetCacheView() to define a new pixel region, 
and SyncCacheView() to save the updated pixel region. The function
GetCacheViewIndexes() provides access to the colormap indexes associated
with the pixel view.

When writing encoders and decoders for new image formats, it is
convenient to have a high-level interface available which supports
converting between external pixel representations and ImageMagick's own
representation. Pixel components(red, green,  blue,  opacity,  RGB,  or RGBA)
may be transferred from a user-supplied buffer into the default view by
using PushImagePixels(). Pixel components may be transferred from the
default view into a user-supplied buffer by using PopImagePixels(). Use
of this high-level interface helps protect image coders from changes to
ImageMagick's pixel representation and simplifies the implementation.

The members of the Image structure are shown in the following table:


\begin{longtable}{llp{9cm}}
\caption{ImageInfo Structure} \\[0.5in]
\multicolumn{3}{c}{ImageInfo Structure}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endfirsthead
\multicolumn{3}{c}{ImageInfo Structure(continued)}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endhead
attributes & ImageAttribute &
Image attribute list. Consists of a doubly-linked-list
of ImageAttribute structures, each of which has an associated key and value.
Access/update list via SetImageAttribute()
and GetImageAttribute().  Key-strings used by ImageMagick include "Comment"
(image comment) , "Label"(image label),  and "Signature" (image signature). \\

background\_color & PixelPacket & Image background color \\

blur & double & Blur factor to apply to the image when zooming \\

border\_color & PixelPacket & Image border color \\

chromaticity & ChromaticityInfo &
Red, green,  blue,  and white-point chromaticity values.  \\

color\_class & ClassType &
Image storage class. If DirectClass
then the image packets contain valid RGB or CMYK colors. If
PseudoClass then the image has a colormap referenced by pixel's index member. \\

color\_profile & ProfileInfo &
ICC color profile. Specifications are available from
the International Color Consortium for the format of ICC color profiles.  \\

colormap & PixelPacket & PseudoColor palette array.  \\

colors & unsigned int &
The desired number of colors. Used by QuantizeImage().  \\

colorspace & ColorspaceType &
Image pixel interpretation.If the colorspace is RGB the
pixels are red, green,  blue. If matte is true,  then red,  green,  blue,  and
index. If it is CMYK, the pixels are cyan,  yellow,  magenta,  black. Otherwise
the colorspace is ignored. \\

columns & unsigned int & Image width \\

comments & char * Image comments \\

compression & CompressionType &
Image compresion type. The default is the compression
type of the specified image file.  \\

delay & unsigned int &
Time in 1/100ths of a second(0 to 65535) which must
expire before displaying the next image in an animated sequence. This option
is useful for regulating the animation of a sequence of GIF images within
Netscape. \\

depth & unsigned int &
Image depth(8 or 16). QuantumLeap must be defined before
a depth of 16 is valid. \\

directory & char * &
Tile names from within an image montage. Only valid after
calling MontageImages() or reading a MIFF file which contains a directory.  \\

dispose & unsigned int &
GIF disposal method. This option is used to control how
successive frames are rendered(how the preceding frame is disposed of)
when creating a GIF animation. \\

exception & ExceptionInfo &
Record of any error which occurred when updating image. \\

file & FILE * &
Stdio stream to read image from or write image to. If
set, ImageMagick will read from or write to the stream rather than opening
a file. Used by ReadImage() and WriteImage().
The stream is closed when the operation completes.  \\

filename & char[MaxTextExtent] &
Image file name to read or write.  \\

filesize & long int &
Number of bytes of the encoded file. \\

filter & FilterTypes &
Filter to use when resizing image. The reduction filter
employed has a significant effect on the time required to resize an image
and the resulting quality. The default filter is Lanczos which has been
shown to produce high quality results when reducing most images.  \\

fuzz & int &
Colors within this distance are considered equal. A number
of algorithms search for a target color. By default the color must be exact.
Use this option to match colors that are close to the target color in RGB
space. \\

gamma & double &
Gamma level of the image. The same color image displayed on two different
workstations may look different due to differences in the display monitor.
Use gamma correction to adjust for this color difference.  \\

geometry & char * &
Preferred size of the image when encoding. \\

interlace & InterlaceType &
The type of interlacing scheme(default NoInterlace).
This option is used to specify the type of interlacing scheme for raw image
formats such as RGB or YUV. NoInterlace means do not interlace, LineInterlace
uses scanline interlacing, and PlaneInterlace uses plane interlacing. PartitionInterlace
is like PlaneInterlace except the different planes are saved to individual
files(e.g. image.R, image.G,  and image.B). Use LineInterlace or PlaneInterlace
to create an interlaced GIF or progressive JPEG image. \\

iptc\_profile & ProfileInfo &
IPTC profile. Specifications are available from the International
Press Telecommunications Council for IPTC profiles.  \\

iterations & unsigned int &
Number of iterations to loop an animation(e.g. Netscape
loop extension) for.  \\

list & struct \_Image * &
Undo image list(used only by 'display') \\

magick & char[MaxTextExtent] &
Image encoding format(e.g. "GIF"). \\

magick\_columns & unsigned int &
Base image width(before transformations) \\

magick\_filename & char[MaxTextExtent] &
Base image filename(before transformations) \\

magick\_rows & unsigned int &
Base image height(before transformations) \\

matte & unsigned int &
If non-zero, then the index member of pixels
represents the alpha channel. \\

matte\_color & PixelPacket &
Image matte(transparent) color \\

mean\_error\_per\_pixel & unsigned int &
The mean error per pixel computed when an image is color
reduced. This parameter is only valid if verbose is set to true and the
image has just been quantized. \\

montage & char * &
Tile size and offset within an image montage. Only valid
for montage images. \\

next & struct \_Image * &
Next image frame in sequence \\

normalized\_maximum\_error & double &
The normalized max error per pixel computed when an image
is color reduced. This parameter is only valid if <i>verbose</i> is set
to true and the image has just been quantized. \\

normalized\_mean\_error & double &
The normalized mean error per pixel computed when an
image is color reduced. This parameter is only valid if verbose
is set to true and the image has just been quantized. \\

offset & int &
Number of initial bytes to skip over when reading raw
image. \\

page & RectangleInfo & Equivalent size of Postscript page. \\

pipe & int &
Set to <i>True</i> if image is read/written from/to a
POSIX pipe. To read from(or write to) an open pipe, set this member to
True, set the file member to a stdio stream representing
the pipe(obtained from popen()), and invoke ReadImage(),  WriteImage().
The pipe is automatically closed via pclose() when the operation completes.  \\

pixels & PixelPacket &
Image pixels retrieved via GetPixelCache()
or initialized via SetPixelCache(). \\

previous & struct \_Image * &
Previous image frame in sequence. \\

rendering\_intent & RenderingIntent & The type of rendering intent. \\

rows & unsigned int & Image height  \\

scene & unsigned int & Image frame scene number. \\

tainted & int &
Set to non-zero(True) if the image pixels have
been modified. \\

tile\_info & RectangleInfo &
Describes a tile within an image. For example, 
if your images is 640x480 you may only want 320x256 with an offset of +128+64.
It is used for raw formats such as RGB and CMYK as well as for TIFF. \\

timer & TimerInfo &
Support for measuring actual(user + system) and elapsed
execution time. \\

total\_colors & unsigned long &
The number of colors in the image after QuantizeImage(), 
or QuantizeImages() if the verbose flag was set before the call.
Calculated by GetNumberColors().  \\

units & ResolutionType & Units of image resolution \\

x\_resolution & double & Horizontal resolution of the image. \\

y\_resolution & double & Vertical resolution of the image \\
\end{longtable}

\subsubsection{ImageAttribute}
The ImageAttribute structure is used to add arbitary textual attributes
to an image. Each attribute has an associated key and value. Add new
attributes, or update an existing attribute,  via SetImageAttribute()
and obtain the value of an existing attribute via GetImageAttribute().
Key-strings used by ImageMagick include "Comment"(image comment), 
"Label"(image label), and "Signature" (image signature).

The members of the ImageAttribute structure are shown in the following
table:

\begin{longtable}{llp{9cm}}
\caption{ImageAttribute Structure} \\[0.5in]
\multicolumn{3}{c}{ImageAttribute Structure}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endfirsthead
\multicolumn{3}{c}{ImageAttribute Structure(continued)}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endhead
key & \var{char *} & key. \\
value & \var{char *} & value. \\
compression & \var{unsigned int} & compression. \\
\end{longtable}

\subsubsection{ImageInfo}

\index{ImageInfo}
The \var{ImageInfo} structure is used to supply option information
to the methods AllocateImage(), AnimateImages(),  BlobToImage(), 
CloneAnnotateInfo(), DisplayImages(),  GetAnnotateInfo(),  ImageToBlob(), 
PingImage(), ReadImage(),  ReadImages(),  and,  WriteImage().  These methods
update information in ImageInfo to reflect attributes of the current
image.

Use CloneImageInfo() to duplicate an existing ImageInfo structure
or allocate a new one.  Use DestroyImageInfo() to deallocate memory
associated with an ImageInfo structure.  Use GetImageInfo() to initialize
an existing ImageInfo structure.  Use SetImageInfo() to set image type
information in the ImageInfo structure based on an existing image.

The members of the ImageInfo structure are shown in the following table:

\begin{longtable}{llp{9cm}}
\caption{ImageInfo Structure} \\[0.5in]
\multicolumn{3}{c}{ImageInfo Structure}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endfirsthead
\multicolumn{3}{c}{ImageInfo Structure(continued)}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endhead
adjoin & unsigned int & Join images into a single multi-image file. \\

antialias & unsigned int &  Control antialiasing of rendered graphic
primitives and text fonts. \\ background\_color & PixelPacket & Image
background color.  \\

border\_color & PixelPacket & Image border color. \\

box & char * & Base color that annotation text is rendered on.  \\

colorspace & ColorspaceType & Image pixel interpretation. If the
colorspace is RGB the pixels are red, green,  blue. If matte is true, 
then red, green,  blue,  and index. If it is CMYK,  the pixels are cyan, 
yellow, magenta,  black. Otherwise the colorspace is ignored. \\

compression & CompressionType & Image compresion type. The default is
the compression type of the specified image file.  \\

delay & char * & Time in 1/100ths of a second(0 to 65535) which must
expire before displaying the next image in an animated sequence. This
option is useful for regulating the animation of a sequence of GIF images
within Netscape. \\

density & char * & Vertical and horizontal resolution in pixels of
the image.  This option specifies an image density when decoding a
Postscript or Portable Document page. Often used with page.  \\

depth & unsigned int & Image depth(8 or 16). QuantumLeap must be defined
before a depth of 16 is valid. \\

dispose & char * & GIF disposal method. This option is used to control
how successive frames are rendered(how the preceding frame is disposed
of) when creating a GIF animation. \\

dither & unsigned int & Apply Floyd/Steinberg error diffusion to the
image. The basic strategy of dithering is to trade intensity resolution
for spatial resolution by averaging the intensities of several neighboring
pixels.  Images which suffer from severe contouring when reducing colors
can be improved with this option. The colors or monochrome option must
be set for this option to take effect.  \\

file & FILE * & Stdio stream to read image from or write image to. If set, 
ImageMagick will read from or write to the stream rather than opening
a file. Used by ReadImage() and WriteImage(). The stream is closed when
the operation completes.  \\

filename & char[MaxTextExtent] & Image file name to read or write.  \\

fill & PixelPacket & Drawing object fill color. \\

font & char * & Text rendering font. If the font is a fully qualified
X server font name, the font is obtained from an X server. To use a
TrueType font, precede the TrueType filename with an @. Otherwise, 
specify a Postscript font name(e.g. "helvetica").  \\

fuzz & int & Colors within this distance are considered equal. A number of
algorithms search for a target color. By default the color must be exact.
Use this option to match colors that are close to the target color in
RGB space.  \\

interlace & InterlaceType & The type of interlacing scheme(default
NoInterlace).  This option is used to specify the type of interlacing
scheme for raw image formats such as RGB or YUV. NoInterlace means do not
interlace, LineInterlace uses scanline interlacing,  and PlaneInterlace
uses plane interlacing.  PartitionInterlace is like PlaneInterlace except
the different planes are saved to individual files(e.g. image.R, image.G, 
and image.B). Use LineInterlace or PlaneInterlace to create an interlaced
GIF or progressive JPEG image.  \\

iterations & char * & Number of iterations to loop an animation
(e.g. Netscape loop extension) for.  \\

linewidth & unsigned int & Line width for drawing lines, circles, 
ellipses, etc.  \\

magick & char[MaxTextExtent] & Image encoding format(e.g. "GIF").  \\

matte\_color & PixelPacket & Image matte(transparent) color.  \\

monochrome & unsigned int & Transform the image to black and white.  \\

page & char * & Equivalent size of Postscript page.  \\

ping & unsigned int & Set to True to read enough of the image to determine
the image columns, rows,  and filesize. The columns,  rows,  and size
attributes are valid after invoking ReadImage() while ping is set. The
image data is not valid after calling ReadImage() if ping is set.  \\

pointsize & double & Text rendering font point size.  \\

preview\_type & PreviewType & Image manipulation preview option. Used by
'display'.  \\

quality & unsigned int & JPEG/MIFF/PNG compression level(default 75).  \\

server\_name & char * & X11 display to display to obtain fonts from, 
or to capture image from.  \\

size & char * & Width and height of a raw image(an image which does not
support width and height information). Size may also be used to affect
the image size read from a multi-resolution format(e.g. Photo CD, JBIG, 
or JPEG.  \\

stroke & PixelPacket & Drawing object outline color.  \\

subimage & unsigned int & Subimage of an image sequence.  \\

subrange & unsigned int & Number of images relative to the base image.  \\

texture & char * & Image filename to use as background texture.  \\

tile & char * & Tile name. \\

units & ResolutionType & Units of image resolution.  \\

verbose & unsigned int & Print detailed information about the image
if True.  \\

view & char * & FlashPix viewing parameters.  \\
\end{longtable}

\subsubsection{MagickInfo}
The MagickInfo structure is used by ImageMagick to register support
for an Image format. The MagickInfo structure is allocated with default
parameters by calling SetMagickInfo(). Image formats are registered by
calling RegisterMagickInfo() which adds the initial structure to a linked
list(at which point it is owned by the list). A pointer to the structure
describing a format may be obtained by calling GetMagickInfo(). Pass the
argument NULL to obtain the first member of this list. A human-readable
list of registered image formats may be printed to a file descriptor by
calling ListMagickInfo().

Support for formats may be provided as a module which is part of the
ImageMagick library, provided by a module which is loaded dynamically at
run-time, or directly by the linked program. Users of ImageMagick will
normally want to create a loadable-module, or support encode/decode of
an image format directly from within their program.

\begin{longtable}{llp{9cm}}
\caption{MagickInfo Structure} \\[0.5in]
\multicolumn{3}{c}{MagickInfo Structure}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endfirsthead
\multicolumn{3}{c}{MagickInfo Structure(continued)}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endhead
tag & \var{const char *} & Magick string(e.g. "GIF") to call this format. \\
decoder & \var{Image *(*decoder)(const ImageInfo *)} &
Function to decode image data and return ImageMagick Image. \\
encoder & \var{unsigned int(*encoder)(const ImageInfo *, Image *)} &
Function to encode image data with options passed via ImageInfo and image
represented by Image. \\
adjoin & \var{unsigned int} & Set to non-zero(True) if this file format
 supports multi-frame images. \\
blob\_support & \var{unsigned int} & Set to non-zero(True) if the encoder and
decoder for this format supports operating arbitrary BLOBs(rather than only
disk files). \\
raw & \var{unsigned int} & Image format does not contain size(must be
specified in ImageInfo). \\
description & \var{char *} & Long form image format description(e.g.
"CompuServe graphics interchange format"). \\
module & \var{char *} & Name of module(e.g. "GIF") which registered this
format. Set to NULL if format is not registered by a module. \\
data & \var{void *} & User specified data. A way to pass any sort of data
structure to the endoder/decoder. To set this, GetMagickInfo() must be called
to first obtain a pointer to the registered structure since it can not be set
via a RegisterMagickInfo() parameter. \\
previous & \var{MagickInfo} & Previous MagickInfo struct in linked-list.
NULL if none. \\
next & \var{MagickInfo} & Next MagickInfo struct in linked-list. NULL if
none. \\
\end{longtable}

\subsubsection{PixelPacket}
The PixelPacket structure is used to represent DirectClass color
pixels in ImageMagick. If the image is indicated as a PseudoClass
image, its DirectClass representation is only valid immediately
after calling SyncImage(). If an image is set as PseudoClass and the
DirectClass representation is modified, the image should then be set as
DirectClass. Use QuantizeImage() to restore the PseudoClass colormap if
the DirectClass representation is modified.

The members of the PixelPacket structure are shown in the following table:

\begin{longtable}{llp{9cm}}
\caption{PixelPacket Structure} \\[0.5in]
\multicolumn{3}{c}{PixelPacket Structure}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endfirsthead
\multicolumn{3}{c}{PixelPacket Structure(continued)}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endhead
red & \var{unsigned short} & red. \\
green & \var{unsigned short} & green. \\
blue & \var{unsigned short} & blue. \\
opacity & \var{unsigned short} & opacity. \\
\end{longtable}

\subsubsection{ProfileInfo}
The ProfileInfo structure is used to represent ICC or IPCT profiles in ImageMagick(stored as an opaque BLOB).

The members of the ProfileInfo structure are shown in the following table:
 

\begin{longtable}{llp{9cm}}
\caption{ProfileInfo Structure} \\[0.5in]
\multicolumn{3}{c}{ProfileInfo Structure}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endfirsthead
\multicolumn{3}{c}{ProfileInfo Structure(continued)}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endhead
length & \var{unsigned int} & length. \\
info & \var{unsigned char *} & data. \\
\end{longtable}

\subsubsection{RectangleInfo}
The RectangleInfo structure is used to represent positioning information in ImageMagick.

The members of the RectangleInfo structure are shown in the following table:

\begin{longtable}{llp{9cm}}
\caption{RectangleInfo Structure} \\[0.5in]
\multicolumn{3}{c}{RectangleInfo Structure}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endfirsthead
\multicolumn{3}{c}{RectangleInfo Structure(continued)}\\[0.5in]
  \textbf{Member} & \textbf{Type} & \textbf{Description} \\
\endhead
width & \var{unsigned int} & width. \\
height & \var{unsigned int} & height. \\
x & \var{int} & x. \\
y & \var{int} & y. \\
\end{longtable}

\section{API Enumerations}
\subsubsection{CacheType}
\subsubsection{ChannelType}
ChannelType is used as an argument when doing color separations. Use
ChannelType when extracting a channel from an image. MatteChannel is useful
for extracting the opacity values from an image.


\begin{longtable}{lp{9cm}}
\caption{ChannelType Enumeration} \\[0.5in]
\multicolumn{2}{c}{ChannelType Enumeration}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endfirsthead
\multicolumn{2}{c}{ChannelType Enumeration(continued)}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endhead
UndefinedChannel & Unset value. \\
RedChannel & Select red channel. \\
GreenChannel & Select green channel. \\
BlueChannel & Select blue channel. \\
MatteChannel & Select matte(opacity values) channel. \\
\end{longtable}

\subsubsection{ClassType}

ClassType specifies the image storage class.

\begin{longtable}{lp{9cm}}
\caption{ClassType Enumeration} \\[0.5in]
\multicolumn{2}{c}{ClassType Enumeration}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endfirsthead
\multicolumn{2}{c}{ClassType Enumeration(continued)}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endhead
UndefinedClass & Unset value. \\
DirectClass & Image is composed of pixels which represent literal color
values. \\
PseudoClass & Image is composed of pixels which specify an index in a color
palette. \\
\end{longtable}

\subsubsection{ColorspaceType}
The ColorspaceType enumeration is used to specify the colorspace that
quantization(color reduction and mapping) is done under or to specify
the colorspace when encoding an output image. Colorspaces are ways of
describing colors to fit the requirements of a particular application
(e.g. Television, offset printing,  color monitors).  Color reduction,  by
default, takes place in the RGBColorspace. Empirical evidence suggests
that distances in color spaces such as YUVColorspace or YIQColorspace
correspond to perceptual color differences more closely han do distances
in RGB space. These color spaces may give better results when color
reducing an image. Refer to quantize for more details.

When encoding an output image, the colorspaces RGBColorspace, 
CMYKColorspace, and GRAYColorspace may be specified. The CMYKColorspace
option is only applicable when writing TIFF, JPEG,  and Adobe Photoshop
bitmap(PSD) files.


\begin{longtable}{lp{9cm}}
\caption{ColorspaceType Enumeration} \\[0.5in]
\multicolumn{2}{c}{ColorspaceType Enumeration}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endfirsthead
\multicolumn{2}{c}{ColorspaceType Enumeration(continued)}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endhead
UndefinedColorspace & Unset value. \\
RGBColorspace & Red-Green-Blue colorspace. \\
GRAYColorspace  & \\
TransparentColorspace & The Transparent color space behaves uniquely in that
 it preserves the matte channel of the image if it exists. \\
OHTAColorspace  & \\
XYZColorspace  & \\
YCbCrColorspace  & \\
YCCColorspace  & \\
YIQColorspace  & \\
YPbPrColorspace  & \\
YUVColorspace  & Y-signal, U-signal,  and V-signal colorspace. YUV is most
widely used to encode color for use in television transmission. \\
CMYKColorspace & Cyan-Magenta-Yellow-Black colorspace. CYMK is a subtractive
color system used by printers and photographers for the rendering of colors
with ink or emulsion, normally on a white surface. \\
sRGBColorspace & \\
\end{longtable}

\subsubsection{CompositeOperator}
CompositeOperator is used to select the image composition algorithm used to
compose a composite image with an image. By default, each of the composite
mage pixels are replaced by the corresponding image tile pixel. Specify
CompositeOperator to select a different algorithm.

\begin{longtable}{lp{9cm}}
\caption{CompositeOperator Enumeration} \\[0.5in]
\multicolumn{2}{c}{CompositeOperator Enumeration}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endfirsthead
\multicolumn{2}{c}{CompositeOperator Enumeration(continued)}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endhead
UndefinedCompositeOp & Unset value. \\
OverCompositeOp & The result is the union of the the two image shapes with the
composite image obscuring image in the region of overlap. \\
InCompositeOp & The result is a simply composite image cut by the shape of
image. None of the image data of image is included in the result. \\
OutCompositeOp & The resulting image is composite image with the shape of
image cut out. \\
AtopCompositeOp & The result is the same shape as image image, with composite
image obscuring image there the image shapes overlap. Note that this differs
from OverCompositeOp because the portion of composite image outside of image's
shape does not appear in the result. \\
XorCompositeOp & The result is the image data from both composite image and
image that is outside the overlap region. The overlap region will be blank. \\
PlusCompositeOp & The result is just the sum of the  image data. Output values
are cropped to 255(no overflow). This operation is independent of the matte
channels. \\
MinusCompositeOp & The result of composite image - image, with overflow
cropped to zero. The matte chanel is ignored(set to 255, full coverage). \\
AddCompositeOp & The result of composite image + image, with overflow wrapping
around(mod 256). \\
SubtractCompositeOp & The result of composite image - image, with underflow 
wrapping around(mod 256). The add and subtract operators can be used to 
perform reverible transformations. \\
DifferenceCompositeOp & The result of abs(composite image - image). This is
useful for comparing two very similar images. \\
BumpmapCompositeOp & The result image shaded by composite image. \\
ReplaceCompositeOp & The resulting image is image replaced with composite
image. Here the matte information is ignored. \\
ReplaceRedCompositeOp & The resulting image is the red channel in image replaced
with the red channel in composite image. The other channels are copied
untouched. \\
ReplaceGreenCompositeOp & The resulting image is the green channel in image
replaced with the green channel in composite image. The other channels are
copied untouched. \\
ReplaceBlueCompositeOp & The resulting image is the blue channel in image
replaced with the blue channel in composite image. The other channels are
copied untouched. \\
ReplaceMatteCompositeOp & The resulting image is the matte channel in image
replaced with the matte channel in composite image. The other channels are copied
untouched.  The image compositor requires a matte, or alpha channel in the
image for some operations. This extra channel usually defines a mask which
represents a sort of a cookie-cutter for the image. This is the case when
matte is 255(full coverage) for pixels inside the shape, zero outside,  and
between zero and 255 on the boundary.  For certain operations, if image does
not have a matte channel, it is initialized with 0 for any pixel matching in
color to pixel location(0, 0), otherwise 255 (to work properly borderWidth
must be 0). \\
\end{longtable}

\subsubsection{CompressionType}
CompressionType is used to express the desired compression type when
encoding an image. Be aware that most image types only support a sub-set
of the available compression types. If the compression type specified
is incompatable with the image, ImageMagick selects a compression type
compatable with the image type.

\begin{longtable}{lp{9cm}}
\caption{CompressionType Enumeration} \\[0.5in]
\multicolumn{2}{c}{CompressionType Enumeration}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endfirsthead
\multicolumn{2}{c}{CompressionType Enumeration(continued)}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endhead
UndefinedCompression & Unset value. \\
NoCompression & No compression. \\
BZipCompression & BZip(Burrows-Wheeler block-sorting text compression
algorithm and Huffman coding) as used by bzip2 utilities. \\
FaxCompression & CCITT Group 3 FAX compression. \\
Group4Compression & CCITT Group 4 FAX compression(used only for TIFF). \\
JPEGCompression & JPEG compression. \\
LZWCompression & Lempel-Ziv-Welch(LZW) compression. \\
RunlengthEncodedCompression & Run-Length encoded(RLE) compression. \\
ZipCompression & Lempel-Ziv compression(LZ77) as used in PKZIP and GNU gzip. \\
\end{longtable}

\subsubsection{DecorationType}
\subsubsection{ExceptionType}
\subsubsection{FilterTypes}
FilterTypes is used to adjust the filter algorithm used when resizing
images. Different filters experience varying degrees of success with
various images and can take sipngicantly different amounts of processing
time. ImageMagick uses the LanczosFilter by default since this filter has
been shown to provide the best results for most images in a reasonable
amount of time. Other filter types(e.g. TriangleFilter) may execute
much faster but may show artifacts when the image is re-sized or around
diagonal lines. The only way to be sure is to test the filter with
sample images.


\begin{longtable}{lp{9cm}}
\caption{FilterTypes Enumeration} \\[0.5in]
\multicolumn{2}{c}{FilterTypes Enumeration}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endfirsthead
\multicolumn{2}{c}{FilterTypes Enumeration(continued)}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endhead
UndefinedFilter & Unset value. \\
PointFilter & Point Filter \\
BoxFilter & Box Filter \\
TriangleFilter & Triangle Filter \\
HermiteFilter & Hermite Filter \\
HanningFilter & Hanning Filter \\
HammingFilter & Hamming Filter \\
BlackmanFilter & Blackman Filter \\
GaussianFilter & Gaussian Filter \\
QuadraticFilter & Quadratic Filter \\
CubicFilter & Cubic Filter \\
CatromFilter & Catrom Filter \\
MitchellFilter & Mitchell Filter \\
LanczosFilter & Lanczos Filter \\
BesselFilter & Bessel Filter \\
SincFilter & Sinc Filter \\
\end{longtable}

\subsubsection{GeometryFlags}
\subsubsection{GravityType}
GravityType specifies positioning of an object(e.g. text, image)
within a bounding region(e.g. an image). Gravity provides a convenient
way to locate objects irrespective of the size of the bounding region, 
in other words, you don't need to provide absolute coordinates in order
to position an object. A common default for gravity is NorthWestGravity.


\begin{longtable}{lp{9cm}}
\caption{GravityType Enumeration} \\[0.5in]
\multicolumn{2}{c}{GravityType Enumeration}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endfirsthead
\multicolumn{2}{c}{GravityType Enumeration(continued)}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endhead
ForgetGravity & Don't use gravity. \\
NorthWestGravity & Position object at top-left of region. \\
NorthGravity & Postiion object at top-center of region. \\
NorthEastGravity & Position object at top-right of region. \\
WestGravity & Position object at left-center of region. \\
CenterGravity & Position object at center of region. \\
EastGravity & Position object at right-center of region. \\
SouthWestGravity & Position object at left-bottom of region. \\
SouthGravity & Position object at bottom-center of region. \\
SouthEastGravity & Position object at bottom-right of region. \\
\end{longtable}

\subsubsection{ImageType}
ImageType indicates the type classification of the image.

\begin{longtable}{lp{9cm}}
\caption{ImageType Enumeration} \\[0.5in]
\multicolumn{2}{c}{ImageType Enumeration}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endfirsthead
\multicolumn{2}{c}{ImageType Enumeration(continued)}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endhead
UndefinedType & Unset value. \\
BilevelType & Monochrome image. \\
GrayscaleType & Grayscale image. \\
PaletteType & Indexed color(palette) image. \\
PaletteMatteType & Indexed color(palette) image with opacity. \\
TrueColorType & Truecolor image. \\
TrueColorMatteType & Truecolor image with opacity. \\
ColorSeparationType & Cyan/Yellow/Magenta/Black(CYMK) image. \\
\end{longtable}

\subsubsection{InterlaceType}
InterlaceType specifies the ordering of the red, green,  and blue pixel
information in the image. Interlacing is usually used to make image
information available to the user faster by taking advantage of the
space vs time tradeoff. For example, interlacing allows images on the
Web to be recognizable sooner and satellite images to accumulate/render
with image resolution increasing over time.

Use LineInterlace or PlaneInterlace to create an interlaced GIF or
progressive JPEG image.

\begin{longtable}{lp{9cm}}
\caption{InterlaceType Enumeration} \\[0.5in]
\multicolumn{2}{c}{InterlaceType Enumeration}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endfirsthead
\multicolumn{2}{c}{InterlaceType Enumeration(continued)}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endhead
UndefinedInterlace & Unset value. \\
NoInterlace & Don't interlace image(RGBRGBRGBRGBRGBRGB...). \\
LineInterlace & Use scanline interlacing
(RRR...GGG...BBB...RRR...GGG...BBB...). \\
PlaneInterlace & Use plane interlacing(RRRRRR...GGGGGG...BBBBBB...). \\
PartitionInterlace & Similar to plane interlaing except that the different
planes are saved to individual files(e.g. image.R, image.G,  and image.B). \\
\end{longtable}

\subsubsection{LineCap}
\subsubsection{LineJoin}
\subsubsection{MapMode}
\subsubsection{MontageMode}
\subsubsection{NoiseType}
NoiseType is used as an argument to select the type of noise to be added
to the image.


\begin{longtable}{lp{9cm}}
\caption{NoiseType Enumeration} \\[0.5in]
\multicolumn{2}{c}{NoiseType Enumeration}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endfirsthead
\multicolumn{2}{c}{NoiseType Enumeration(continued)}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endhead
UniformNoise & Uniform noise. \\
GaussianNoise & Gaussian noise. \\
MultiplicativeGaussianNoise & Multiplicative Gaussian noise. \\
ImpulseNoise & Impulse noise. \\
LaplacianNoise & Laplacian noise. \\
PoissonNoise & Poisson noise. \\
\end{longtable}

\subsubsection{PaintMethod}
PaintMethod specifies how pixel colors are to be replaced in the image. It
is used to select the pixel-filling algorithm employed.

\begin{longtable}{lp{9cm}}
\caption{PaintMethod Enumeration} \\[0.5in]
\multicolumn{2}{c}{PaintMethod Enumeration}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endfirsthead
\multicolumn{2}{c}{PaintMethod Enumeration(continued)}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endhead
PointMethod & Replace pixel color at point. \\
ReplaceMethod & Replace color for all image pixels matching color at point. \\
FloodfillMethod & Replace color for pixels surrounding point until encountering pixel that fails to match color at point. \\
FillToBorderMethod & Replace color for pixels surrounding point until encountering pixels matching border color. \\
ResetMethod & Replace colors for all pixels in image with pen color. \\
\end{longtable}

\subsubsection{ProfileType}
\subsubsection{PreviewType}
\subsubsection{PrimitiveType}
\subsubsection{PrimitiveType}
\subsubsection{RenderingIntent}
Rendering intent is a concept defined by ICC Spec ICC.1:1998-09, "File
Format for Color Profiles". ImageMagick uses RenderingIntent in order
to support ICC Color Profiles.

From the specification: "Rendering intent specifies the style of
reproduction to be used during the evaluation of this profile in
a sequence of profiles. It applies specifically to that profile in
the sequence and not to the entire sequence. Typically, the user or
application will set the rendering intent dynamically at runtime or
embedding time."

\begin{longtable}{lp{9cm}}
\caption{RenderingIntent Enumeration} \\[0.5in]
\multicolumn{2}{c}{RenderingIntent Enumeration}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endfirsthead
\multicolumn{2}{c}{RenderingIntent Enumeration(continued)}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endhead
UndefinedIntent & Unset value. \\
SaturationIntent & A rendering intent that specifies the saturation of the pixels in the image is preserved perhaps at the expense of accuracy in hue and lightness. \\
PerceptualIntent & A rendering intent that specifies the full gamut of the image is compressed or expanded to fill the gamut of the destination device. Gray balance is preserved but colorimetric accuracy might not be preserved. \\
AbsoluteIntent & Absolute colorimetric. \\
RelativeIntent & Relative colorimetric. \\
\end{longtable}

\subsubsection{ResolutionType}

By default, ImageMagick defines resolutions in pixels per
inch. ResolutionType provides a means to adjust this.

\begin{longtable}{lp{9cm}}
\caption{ResolutionType Enumeration} \\[0.5in]
\multicolumn{2}{c}{ResolutionType Enumeration}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endfirsthead
\multicolumn{2}{c}{ResolutionType Enumeration(continued)}\\[0.5in]
  \textbf{Enumeration} & \textbf{Description} \\
\endhead
UndefinedResolution  & Unset value. \\
PixelsPerInchResolution & Density specifications are specified in units of
pixels per inch(english units). \\
PixelsPerCentimeterResolution & Density specifications are specified in units
of pixels per centimeter (metric units). \\
\end{longtable}

