Squantize - Methods to Reduce the Number of Unique Colors in an Image;/


NAME



Dquantize - Methods to Reduce the Number of Unique Colors in an Image




(

SYNOPSIS



=cloned_info=CloneQuantizeInfo(quantize_info)

,DestroyCubeInfo(cube_info))

3DestroyQuantizeInfo(quantize_info)

/GetQuantizeInfo(quantize_info)

8status=MapImage(image,map_image,dither)

:status=MapImages(images,map_image,dither)

0status=QuantizationError(image)

:status=QuantizeImage(quantize_info,image)

Jstatus=QuantizeImages(quantize_info,number_images,images)




B

FUNCTION DESCRIPTIONS






:

CloneQuantizeInfo



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

/The format of the CloneQuantizeInfo routine is:

9

        cloned_info=CloneQuantizeInfo(quantize_info)


(A description of each parameter follows:

:
cloned_info:


KMethod CloneQuantizeInfo returns a duplicate of the given image info, or ifimage info is NULL a new one.'

quantize_info:


a structure of type info.






6

DestroyCubeInfo



CMethod DestroyCubeInfo deallocates memory associated with an image.

-The format of the DestroyCubeInfo routine is:

(

        DestroyCubeInfo(cube_info))


(A description of each parameter follows:

#
cube_info:


,The address of a structure of type CubeInfo.






>

DestroyQuantizeInfo



@Method DestroyQuantizeInfo deallocates memory associated with anQuantizeInfo structure.

1The format of the DestroyQuantizeInfo routine is:

/

        DestroyQuantizeInfo(quantize_info)


(A description of each parameter follows:

'
quantize_info:


1Specifies a pointer to an QuantizeInfo structure.






6

GetQuantizeInfo



>Method GetQuantizeInfo initializes the QuantizeInfo structure.

-The format of the GetQuantizeInfo routine is:

+

        GetQuantizeInfo(quantize_info)


(A description of each parameter follows:

'
quantize_info:


0Specifies a pointer to a QuantizeInfo structure.






(

MapImage



FMapImage replaces the colors of an image with the closest color from areference image.

&The format of the MapImage routine is:

4

        status=MapImage(image,map_image,dither)


(A description of each parameter follows:


image:


*Specifies a pointer to an Image structure.#

map_image:


ISpecifies a pointer to a Image structure. Reduce image to a set of colorsrepresented by this image.

dither:


KSet this integer value to something other than zero to dither the quantizedimage.






*

MapImages



FMapImages replaces the colors of a sequence of images with the closestcolor from a reference image.

&The format of the MapImage routine is:

6

        status=MapImages(images,map_image,dither)


(A description of each parameter follows:


image:


1Specifies a pointer to a set of Image structures.#

map_image:


ISpecifies a pointer to a Image structure. Reduce image to a set of colorsrepresented by this image.

dither:


KSet this integer value to something other than zero to dither the quantizedimage.






:

QuantizationError



IMethod QuantizationError measures the difference between the original andFquantized images. This difference is the total quantization error. TheEerror is computed by summing over all pixels in an image the distanceIsquared 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.6

normalized_mean_square_error:


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

normalized_maximum_square_error:


FThsi value is the normalized maximum quantization error for any singleJpixel in the image. This distance measure is normalized to a range betweenI0 and 1. It is independent of the range of red, green, and blue values in your image.



/The format of the QuantizationError routine is:

,

        status=QuantizationError(image)


(A description of each parameter follows.


image:


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






2

QuantizeImage



EMethod QuantizeImage analyzes the colors within a reference image andHchooses a fixed number of colors to represent the image. The goal of theJalgorithm is to minimize the difference between the input and output image%while minimizing the processing time.

+The format of the QuantizeImage routine is:

6

        status=QuantizeImage(quantize_info,image)


(A description of each parameter follows:

'
quantize_info:


1Specifies a pointer to an QuantizeInfo structure.

image:


)Specifies a pointer to a Image structure.






4

QuantizeImages



GQuantizeImages analyzes the colors within a set of reference images andFchooses a fixed number of colors to represent the set. The goal of theKalgorithm is to minimize the difference between the input and output images%while minimizing the processing time.

,The format of the QuantizeImages routine is:

F

        status=QuantizeImages(quantize_info,number_images,images)


(A description of each parameter follows:

'
quantize_info:


1Specifies a pointer to an QuantizeInfo structure.'

number_images:


ISpecifies an unsigned integer representing the number images in the imageset.

images:


2Specifies a pointer to a list of Image structures.