NAME

quantize - Reduce the Number of Unique Colors in an Image


SYNOPSIS

MapImage(image,map_image,dither)

MapImages(images,map_image,dither)

PruneLevel(node)

QuantizationError(image)

QuantizeImage(quantize_info,image)

QuantizeImages(quantize_info,number_images,images)


FUNCTION DESCRIPTIONS


XGetQuantizeInfo

Function XGetMontageInfo initializes the MontageInfo structure.

The format of the GetMontageInfo routine is:

    XGetMontageInfo(quantize_info)

A description of each parameter follows:

quantize_info:
Specifies a pointer to a MontageInfo structure.


PruneLevel

Procedure PruneLevel deletes all nodes at the bottom level of the color tree merging their color statistics into their parent node.

The format of the PruneLevel routine is:

        PruneLevel(node)

A description of each parameter follows.

node:
pointer to node in color cube tree that is to be pruned.


MapImage

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

The format of the MapImage routine is:

        MapImage(image,map_image,dither)

A description of each parameter follows:

image:
Specifies a pointer to an Image structure.

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

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


MapImages

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

The format of the MapImage routine is:

        MapImages(images,map_image,dither)

A description of each parameter follows:

image:
Specifies a pointer to a set of Image structures.

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

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


QuantizationError

Function 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:

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

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.

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.

The format of the QuantizationError routine is:

        QuantizationError(image)

A description of each parameter follows.

image:
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.


QuantizeImage

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

The format of the QuantizeImage routine is:

        QuantizeImage(quantize_info,image)

A description of each parameter follows:

quantize_info:
Specifies a pointer to an QuantizeInfo structure.

image:
Specifies a pointer to a Image structure.


QuantizeImages

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

The format of the QuantizeImages routine is:

        QuantizeImages(quantize_info,number_images,images)

A description of each parameter follows:

quantize_info:
Specifies a pointer to an QuantizeInfo structure.

number_images:
Specifies an unsigned integer representing the number images in the image set.

images:
Specifies a pointer to a list of Image structures.