Squantize - Methods to Reduce the Number of Unique Colors in an Image9W




"NAME

K

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



2page index




&SYNOPSIS

^

QuantizeInfo * CloneQuantizeInfo( const QuantizeInfo *quantize_info );

K

DestroyQuantizeInfo( QuantizeInfo *quantize_info );

G

GetQuantizeInfo( QuantizeInfo *quantize_info );

l

unsigned int MapImage( Image *image, Image *map_image, const unsigned int dither );

n

unsigned int MapImages( Image *images, Image *map_image, const unsigned int dither );

H

unsigned int QuantizationError( Image *image );

g

unsigned int QuantizeImage( const QuantizeInfo *quantize_info, Image *image );

i

unsigned int QuantizeImages( const QuantizeInfo *quantize_info, Image *images );



2page index


$

FUNCTION *DESCRIPTIONS



:

CloneQuantizeInfo

k

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

5

The format of the CloneQuantizeInfo method is:

¯
QuantizeInfo *CloneQuantizeInfo ( const QuantizeInfo *quantize_info );

AA description of each parameter follows:


J

clone_info:

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

P

quantize_info:

a structure of type info.



>

DestroyQuantizeInfo

_

Method DestroyQuantizeInfo deallocates memory associated with an QuantizeInfo structure.

7

The format of the DestroyQuantizeInfo method is:

w
DestroyQuantizeInfo ( QuantizeInfo *quantize_info );

AA description of each parameter follows:


*

quantize_info:

1Specifies a pointer to an QuantizeInfo structure.



6

GetQuantizeInfo

E

Method GetQuantizeInfo initializes the QuantizeInfo structure.

3

The format of the GetQuantizeInfo method is:

s
GetQuantizeInfo ( QuantizeInfo *quantize_info );

AA description of each parameter follows:


*

quantize_info:

0Specifies a pointer to a QuantizeInfo structure.



(

MapImage

^

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

,

The format of the MapImage method is:

¯
unsigned int MapImage ( Image *image, Image *map_image, const unsigned int dither );

AA description of each parameter follows:


@

image:

*Specifies a pointer to an Image structure.

H

map_image:

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

B

dither:

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



*

MapImages

k

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

,

The format of the MapImage method is:

±
unsigned int MapImages ( Image *images, Image *map_image, const unsigned int dither );

AA description of each parameter follows:


"

image:

1Specifies a pointer to a set of Image structures.

&

map_image:

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

#

dither:

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



:

QuantizationError

ç

Method QuantizationError measures the difference between the original and quantized images. This difference is the total quantization error. The error is computed by summing over all pixels in an image the distance squared in zRGB 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.

n

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.

t

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.

5

The format of the QuantizationError method is:

l
unsigned int QuantizationError ( Image *image );

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



2

QuantizeImage



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

1

The format of the QuantizeImage method is:

±
unsigned int QuantizeImage ( const QuantizeInfo *quantize_info, Image *image );

AA description of each parameter follows:


*

quantize_info:

1Specifies a pointer to an QuantizeInfo structure.

"

image:

)Specifies a pointer to a Image structure.



4

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.

2

The format of the QuantizeImages method is:

³
unsigned int QuantizeImages ( const QuantizeInfo *quantize_info, Image *images );

AA description of each parameter follows:


*

quantize_info:

1Specifies a pointer to an QuantizeInfo structure.

B

images:

2Specifies a pointer to a list of Image structures.
9

page index