<HTML>
<HEAD>
<TITLE>quantize - Methods to Reduce the Number of Unique Colors in an Image</TITLE>
<LINK REV="made" HREF="mailto:cristy@mystic.es.dupont.com">
</HEAD>

<body background="../../images/background.gif">

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#FUNCTION_DESCRIPTIONS">FUNCTION DESCRIPTIONS</A>
	<UL>

		<LI><A HREF="#CloneQuantizeInfo">CloneQuantizeInfo</A>
		<LI><A HREF="#DestroyCubeInfo">DestroyCubeInfo</A>
		<LI><A HREF="#DestroyQuantizeInfo">DestroyQuantizeInfo</A>
		<LI><A HREF="#GetQuantizeInfo">GetQuantizeInfo</A>
		<LI><A HREF="#MapImage">MapImage</A>
		<LI><A HREF="#MapImages">MapImages</A>
		<LI><A HREF="#QuantizationError">QuantizationError</A>
		<LI><A HREF="#QuantizeImage">QuantizeImage</A>
		<LI><A HREF="#QuantizeImages">QuantizeImages</A>
	</UL>

</UL>
<!-- INDEX END -->

<HR>
<P>
<H1><A NAME="NAME">NAME</A></H1>
<P>
quantize - Methods to Reduce the Number of Unique Colors in an Image

<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<P>
cloned_info=<STRONG>CloneQuantizeInfo</STRONG>(quantize_info)

<P>
<STRONG>DestroyCubeInfo</STRONG>(cube_info))

<P>
<STRONG>DestroyQuantizeInfo</STRONG>(quantize_info)

<P>
<STRONG>GetQuantizeInfo</STRONG>(quantize_info)

<P>
status=<STRONG>MapImage</STRONG>(image,map_image,dither)

<P>
status=<STRONG>MapImages</STRONG>(images,map_image,dither)

<P>
status=<STRONG>QuantizationError</STRONG>(image)

<P>
status=<STRONG>QuantizeImage</STRONG>(quantize_info,image)

<P>
status=<STRONG>QuantizeImages</STRONG>(quantize_info,number_images,images)

<P>
<HR>
<H1><A NAME="FUNCTION_DESCRIPTIONS">FUNCTION DESCRIPTIONS</A></H1>
<P>
<HR>
<H2><A NAME="CloneQuantizeInfo">CloneQuantizeInfo</A></H2>
<P>
Method CloneQuantizeInfo makes a duplicate of the given quantize info, or
if quantize info is NULL, a new one.

<P>
The format of the CloneQuantizeInfo routine is:

<P>
<PRE>        cloned_info=CloneQuantizeInfo(quantize_info)
</PRE>
<P>
A description of each parameter follows:

<DL><DL>
<DT><STRONG><A NAME="item_o">cloned_info:</A></STRONG><DD>
<P>
Method CloneQuantizeInfo returns a duplicate of the given image info, or if
image info is NULL a new one.

<DT><STRONG>quantize_info:</STRONG><DD>
<P>
a structure of type info.

</DL></DL>
<P>
<HR>
<H2><A NAME="DestroyCubeInfo">DestroyCubeInfo</A></H2>
<P>
Method DestroyCubeInfo deallocates memory associated with an image.

<P>
The format of the DestroyCubeInfo routine is:

<P>
<PRE>        DestroyCubeInfo(cube_info))
</PRE>
<P>
A description of each parameter follows:

<DL><DL>
<DT><STRONG>cube_info:</STRONG><DD>
<P>
The address of a structure of type CubeInfo.

</DL></DL>
<P>
<HR>
<H2><A NAME="DestroyQuantizeInfo">DestroyQuantizeInfo</A></H2>
<P>
Method DestroyQuantizeInfo deallocates memory associated with an
QuantizeInfo structure.

<P>
The format of the DestroyQuantizeInfo routine is:

<P>
<PRE>        DestroyQuantizeInfo(quantize_info)
</PRE>
<P>
A description of each parameter follows:

<DL><DL>
<DT><STRONG>quantize_info:</STRONG><DD>
<P>
Specifies a pointer to an QuantizeInfo structure.

</DL></DL>
<P>
<HR>
<H2><A NAME="GetQuantizeInfo">GetQuantizeInfo</A></H2>
<P>
Method GetQuantizeInfo initializes the QuantizeInfo structure.

<P>
The format of the GetQuantizeInfo routine is:

<P>
<PRE>        GetQuantizeInfo(quantize_info)
</PRE>
<P>
A description of each parameter follows:

<DL><DL>
<DT><STRONG>quantize_info:</STRONG><DD>
<P>
Specifies a pointer to a QuantizeInfo structure.

</DL></DL>
<P>
<HR>
<H2><A NAME="MapImage">MapImage</A></H2>
<P>
MapImage replaces the colors of an image with the closest color from a
reference image.

<P>
The format of the MapImage routine is:

<P>
<PRE>        status=MapImage(image,map_image,dither)
</PRE>
<P>
A description of each parameter follows:

<DL><DL>
<DT><STRONG>image:</STRONG><DD>
<P>
Specifies a pointer to an Image structure.

<DT><STRONG>map_image:</STRONG><DD>
<P>
Specifies a pointer to a Image structure. Reduce image to a set of colors
represented by this image.

<DT><STRONG>dither:</STRONG><DD>
<P>
Set this integer value to something other than zero to dither the quantized
image.

</DL></DL>
<P>
<HR>
<H2><A NAME="MapImages">MapImages</A></H2>
<P>
MapImages replaces the colors of a sequence of images with the closest
color from a reference image.

<P>
The format of the MapImage routine is:

<P>
<PRE>        status=MapImages(images,map_image,dither)
</PRE>
<P>
A description of each parameter follows:

<DL><DL>
<DT><STRONG>image:</STRONG><DD>
<P>
Specifies a pointer to a set of Image structures.

<DT><STRONG>map_image:</STRONG><DD>
<P>
Specifies a pointer to a Image structure. Reduce image to a set of colors
represented by this image.

<DT><STRONG>dither:</STRONG><DD>
<P>
Set this integer value to something other than zero to dither the quantized
image.

</DL></DL>
<P>
<HR>
<H2><A NAME="QuantizationError">QuantizationError</A></H2>
<P>
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:

<DL><DL>
<DT><STRONG>mean_error_per_pixel:</STRONG><DD>
<P>
This value is the mean error for any single pixel in the image.

<DT><STRONG>normalized_mean_square_error:</STRONG><DD>
<P>
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.

<DT><STRONG>normalized_maximum_square_error:</STRONG><DD>
<P>
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.

</DL></DL>
<P>
The format of the QuantizationError routine is:

<P>
<PRE>        status=QuantizationError(image)
</PRE>
<P>
A description of each parameter follows.

<DL><DL>
<DT><STRONG>image:</STRONG><DD>
<P>
The address of a byte (8 bits) array of run-length encoded pixel data of
your reference image. The sum of the run-length counts in the reference
image must be equal to or exceed the number of pixels.

</DL></DL>
<P>
<HR>
<H2><A NAME="QuantizeImage">QuantizeImage</A></H2>
<P>
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.

<P>
The format of the QuantizeImage routine is:

<P>
<PRE>        status=QuantizeImage(quantize_info,image)
</PRE>
<P>
A description of each parameter follows:

<DL><DL>
<DT><STRONG>quantize_info:</STRONG><DD>
<P>
Specifies a pointer to an QuantizeInfo structure.

<DT><STRONG>image:</STRONG><DD>
<P>
Specifies a pointer to a Image structure.

</DL></DL>
<P>
<HR>
<H2><A NAME="QuantizeImages">QuantizeImages</A></H2>
<P>
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.

<P>
The format of the QuantizeImages routine is:

<P>
<PRE>        status=QuantizeImages(quantize_info,number_images,images)
</PRE>
<P>
A description of each parameter follows:

<DL><DL>
<DT><STRONG>quantize_info:</STRONG><DD>
<P>
Specifies a pointer to an QuantizeInfo structure.

<DT><STRONG>number_images:</STRONG><DD>
<P>
Specifies an unsigned integer representing the number images in the image
set.

<DT><STRONG>images:</STRONG><DD>
<P>
Specifies a pointer to a list of Image structures.

</DL></DL>
</BODY>

</HTML>
