m+ISquantize - Methods to Reduce the Number of Unique Colors in an Image>j Pair








NAME

K

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






(

SYNOPSIS

^

QuantizeInfo * CloneQuantizeInfo( const QuantizeInfo *quantize_info );

D

void CompressImageColormap( Image *image );

K

DestroyQuantizeInfo( QuantizeInfo *quantize_info );

L

unsigned int GetImageQuantizeError( Image *image );

G

GetQuantizeInfo( QuantizeInfo *quantize_info );

r

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

n

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

I

unsigned int OrderedDitherImage( Image *image );

g

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

i

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






B

FUNCTION DESCRIPTIONS





:

CloneQuantizeInfo



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

A description of each parameter follows:


K
o clone_info:


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


Q
o quantize_info:


a structure of type info.





B

CompressImageColormap

º
CompressImageColormap() compresses an image colormap by removing any duplicate or unused color entries.

The format of the CompressImageColormap method is:

void CompressImageColormap ( Image *image );

A description of each parameter follows:


A
o image:


The image.





>

DestroyQuantizeInfo

_

Method DestroyQuantizeInfo deallocates memory associated with an QuantizeInfo structure.

7

The format of the DestroyQuantizeInfo method is:

£
DestroyQuantizeInfo ( QuantizeInfo *quantize_info );

A description of each parameter follows:


+
o quantize_info:


1Specifies a pointer to an QuantizeInfo structure.





B

GetImageQuantizeError

_
GetImageQuantizeError() 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:
_
o mean_error_per_pixel:


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


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


u
o 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.

9

The format of the GetImageQuantizeError method is:

œ
unsigned int GetImageQuantizeError ( Image *image );

A description of each parameter follows.


#
o image:


CSpecifies a pointer to an Image structure; returned from ReadImage.





6

GetQuantizeInfo

E

Method GetQuantizeInfo initializes the QuantizeInfo structure.

3

The format of the GetQuantizeInfo method is:

Ÿ
GetQuantizeInfo ( QuantizeInfo *quantize_info );

A description of each parameter follows:


+
o 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, const Image *map_image, const unsigned int dither );

A description of each parameter follows:


#
o image:


*Specifies a pointer to an Image structure.


I
o map_image:


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


C
o 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 );

A description of each parameter follows:


#
o image:


1Specifies a pointer to a set of Image structures.


'
o map_image:


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


$
o dither:


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





<

OrderedDitherImage

´

Method OrderedDitherImage uses the ordered dithering technique of reducing color images to monochrome using positional information to retain as much information as possible.

6

The format of the OrderedDitherImage method is:

unsigned int OrderedDitherImage ( Image *image );

A description of each parameter follows.


#
o image:


CSpecifies a pointer to an Image structure; returned from ReadImage.





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

A description of each parameter follows:


+
o quantize_info:


1Specifies a pointer to an QuantizeInfo structure.


#
o 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 );

A description of each parameter follows:


+
o quantize_info:


1Specifies a pointer to an QuantizeInfo structure.


C
o images:


2Specifies a pointer to a list of Image structures.