- NAME
- SYNOPSIS
- FUNCTION DESCRIPTIONS

- CloneQuantizeInfo
- CompressImageColormap
- DestroyQuantizeInfo
- GetImageQuantizeError
- GetQuantizeInfo
- MapImage
- MapImages
- OrderedDitherImage
- PosterizeImage
- QuantizeImage
- QuantizeImages

# NAME

quantize - Reduce the Number of Unique Colors in an Image

# SYNOPSIS

QuantizeInfo * CloneQuantizeInfo( const QuantizeInfo *quantize_info );

void CompressImageColormap( Image *image );

QuantizeInfo * DestroyQuantizeInfo( QuantizeInfo *quantize_info );

MagickBooleanType GetImageQuantizeError( Image *image );

GetQuantizeInfo( QuantizeInfo *quantize_info );

MagickBooleanType MapImage( Image *image, const Image *map_image, const MagickBooleanType dither );

MagickBooleanType MapImages( Image *images, Image *map_image, const MagickBooleanType dither );

MagickBooleanType OrderedDitherImage( Image *image );

MagickBooleanType PosterizeImage( Image *image, const unsigned long levels, const MagickBooleanType dither );

MagickBooleanType QuantizeImage( const QuantizeInfo *quantize_info, Image *image );

MagickBooleanType QuantizeImages( const QuantizeInfo *quantize_info, Image *images );

# FUNCTION DESCRIPTIONS

## CloneQuantizeInfo

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

The format of the CloneQuantizeInfo method is:

> QuantizeInfo *CloneQuantizeInfo ( const QuantizeInfo *quantize_info );

A description of each parameter follows:

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

quantize_info:
  a structure of type info.

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

image:
  The image.

## DestroyQuantizeInfo

> DestroyQuantizeInfo() deallocates memory associated with an QuantizeInfo structure.

The format of the DestroyQuantizeInfo method is:

> QuantizeInfo *DestroyQuantizeInfo ( QuantizeInfo *quantize_info );

A description of each parameter follows:

quantize_info:
  Specifies a pointer to an QuantizeInfo structure.

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

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 GetImageQuantizeError method is:

> MagickBooleanType GetImageQuantizeError ( Image *image );

A description of each parameter follows.

image:
  Specifies a pointer to an Image structure; returned from ReadImage.

## GetQuantizeInfo

> GetQuantizeInfo() initializes the QuantizeInfo structure.

The format of the GetQuantizeInfo method is:

> GetQuantizeInfo ( QuantizeInfo *quantize_info );

A description of each parameter follows:

quantize_info:
  Specifies 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:

> MagickBooleanType MapImage ( Image *image, const Image *map_image, const MagickBooleanType dither );

A description of each parameter follows:

image:
  Specifies a pointer to an Image structure.

map_image:
  The image. Reduce image to a set of colors represented by this image.

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

## MapImages

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

The format of the MapImage method is:

> MagickBooleanType MapImages ( Image *images, Image *map_image, const MagickBooleanType dither );

A description of each parameter follows:

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

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

## OrderedDitherImage

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

The format of the OrderedDitherImage method is:

> MagickBooleanType OrderedDitherImage ( Image *image );

A description of each parameter follows.

image:
  The image.

## PosterizeImage

> PosterizeImage() reduces the image to a limited number of colors for a "poster" effect.

The format of the PosterizeImage method is:

> MagickBooleanType PosterizeImage ( Image *image, const unsigned long levels, const MagickBooleanType dither );

A description of each parameter follows:

image:
  Specifies a pointer to an Image structure.

levels:
  Number of color levels allowed in each channel. Very low values (2, 3, or 4) have the most visible effect.

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

## QuantizeImage

> 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 color difference between the input and output image while minimizing the processing time.

The format of the QuantizeImage method is:

> MagickBooleanType QuantizeImage ( const QuantizeInfo *quantize_info, Image *image );

A description of each parameter follows:

quantize_info:
  Specifies a pointer to an QuantizeInfo structure.

image:
  The image.

## 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 color difference between the input and output images while minimizing the processing time.

The format of the QuantizeImages method is:

> MagickBooleanType QuantizeImages ( const QuantizeInfo *quantize_info, Image *images );

A description of each parameter follows:

quantize_info:
  Specifies a pointer to an QuantizeInfo structure.

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

"Image manipulation software that works like magick"