# quantize.c File Reference

`#include "magick/studio.h"`
`#include "magick/cache-view.h"`
`#include "magick/color.h"`
`#include "magick/color-private.h"`
`#include "magick/colorspace.h"`
`#include "magick/enhance.h"`
`#include "magick/exception.h"`
`#include "magick/exception-private.h"`
`#include "magick/image.h"`
`#include "magick/image-private.h"`
`#include "magick/list.h"`
`#include "magick/memory_.h"`
`#include "magick/option.h"`
`#include "magick/pixel-private.h"`
`#include "magick/quantize.h"`
`#include "magick/quantum.h"`
`#include "magick/monitor.h"`
`#include "magick/string_.h"`

## Data Structures

struct | _NodeInfo
struct | _Nodes
struct | _CubeInfo

## Defines

#define | CacheShift 2
#define | ErrorQueueLength 16
#define | MaxNodes 266817
#define | MaxTreeDepth 8
#define | NodesInAList 1920
#define | AssignImageTag "Assign/Image"
#define | ClassifyImageTag "Classify/Image"
#define | DitherImageTag "Dither/Image"
#define | ReduceImageTag "Reduce/Image"

## Typedefs

typedef struct _NodeInfo | NodeInfo
typedef struct _Nodes | Nodes
typedef struct _CubeInfo | CubeInfo

## Functions

static void | ClosestColor (const Image *, CubeInfo *, const NodeInfo *)
static NodeInfo * | GetNodeInfo (CubeInfo *, const unsigned long, const unsigned long, NodeInfo *)
static MagickBooleanType | DitherImage (Image *, CubeInfo *)
static unsigned long | DefineImageColormap (Image *, CubeInfo *, NodeInfo *)
static void | HilbertCurve (const Image *, ViewInfo *, CubeInfo *, const unsigned long, const unsigned int)
static void | PruneLevel (const Image *, CubeInfo *, const NodeInfo *)
static void | PruneToCubeDepth (const Image *, CubeInfo *, const NodeInfo *)
static void | ReduceImageColors (const Image *, CubeInfo *)
MagickExport QuantizeInfo * | AcquireQuantizeInfo (const ImageInfo *image_info)
static MagickBooleanType | IsAssociatedAlpha (const Image *image, const CubeInfo *cube_info)
static RealPixelPacket | AssociateAlphaPixel (const Image *image, const CubeInfo *cube_info, const PixelPacket *pixel)
static unsigned long | ColorToNodeId (const Image *image, const CubeInfo *cube_info, const RealPixelPacket *pixel, unsigned long index)
static MagickBooleanType | AssignImageColors (Image *image, CubeInfo *cube_info)
static MagickBooleanType | ClassifyImageColors (CubeInfo *cube_info, const Image *image, ExceptionInfo *exception)
MagickExport QuantizeInfo * | CloneQuantizeInfo (const QuantizeInfo *quantize_info)
MagickExport void | CompressImageColormap (Image *image)
static void | DestroyCubeInfo (CubeInfo *cube_info)
MagickExport QuantizeInfo * | DestroyQuantizeInfo (QuantizeInfo *quantize_info)
static MagickBooleanType | Dither (const Image *image, ViewInfo *image_view, CubeInfo *cube_info, const unsigned int direction)
static unsigned long | MagickMax (const unsigned long x, const unsigned long y)
static unsigned long | MagickMin (const unsigned long x, const unsigned long y)
static CubeInfo * | GetCubeInfo (const QuantizeInfo *quantize_info, const unsigned long depth, const unsigned long maximum_colors)
MagickExport MagickBooleanType | GetImageQuantizeError (Image *image)
MagickExport void | GetQuantizeInfo (QuantizeInfo *quantize_info)
MagickExport MagickBooleanType | MapImage (Image *image, const Image *map_image, const MagickBooleanType dither)
MagickExport MagickBooleanType | MapImages (Image *images, const Image *map_image, const MagickBooleanType dither)
MagickExport MagickBooleanType | PosterizeImage (Image *image, const unsigned long levels, const MagickBooleanType dither)
static void | PruneChild (const Image *image, CubeInfo *cube_info, const NodeInfo *node_info)
MagickExport MagickBooleanType | QuantizeImage (const QuantizeInfo *quantize_info, Image *image)
MagickExport MagickBooleanType | QuantizeImages (const QuantizeInfo *quantize_info, Image *images)
static void | Reduce (const Image *image, CubeInfo *cube_info, const NodeInfo *node_info)

## Define Documentation

#define AssignImageTag "Assign/Image"

#define CacheShift 2

#define ClassifyImageTag "Classify/Image"

#define DitherImageTag "Dither/Image"

#define ErrorQueueLength 16

#define MaxNodes 266817

#define MaxTreeDepth 8

#define NodesInAList 1920

#define ReduceImageTag "Reduce/Image"

## Typedef Documentation

typedef struct _CubeInfo CubeInfo

typedef struct _NodeInfo NodeInfo

typedef struct _Nodes Nodes

## Function Documentation

MagickExport QuantizeInfo* AcquireQuantizeInfo | ( | const ImageInfo * | image_info | ) |

static MagickBooleanType AssignImageColors | ( | Image * | image,
|  | CubeInfo * | cube_info |
| ) |  |  | `[static]`

static RealPixelPacket AssociateAlphaPixel | ( | const Image * | image,
|  | const CubeInfo * | cube_info,
|  | const PixelPacket * | pixel |
| ) |  |  | `[inline, static]`

static MagickBooleanType ClassifyImageColors | ( | CubeInfo * | cube_info,
|  | const Image * | image,
|  | ExceptionInfo * | exception |
| ) |  |  | `[static]`

MagickExport QuantizeInfo* CloneQuantizeInfo | ( | const QuantizeInfo * | quantize_info | ) |

static void ClosestColor | ( | const Image * | image,
|  | CubeInfo * | cube_info,
|  | const NodeInfo * | node_info |
| ) |  |  | `[static]`

static unsigned long ColorToNodeId | ( | const Image * | image,
|  | const CubeInfo * | cube_info,
|  | const RealPixelPacket * | pixel,
|  | unsigned long | index |
| ) |  |  | `[inline, static]`

MagickExport void CompressImageColormap | ( | Image * | image | ) |

static unsigned long DefineImageColormap | ( | Image * | image,
|  | CubeInfo * | cube_info,
|  | NodeInfo * | node_info |
| ) |  |  | `[static]`

static void DestroyCubeInfo | ( | CubeInfo * | cube_info | ) | `[static]`

MagickExport QuantizeInfo* DestroyQuantizeInfo | ( | QuantizeInfo * | quantize_info | ) |

static MagickBooleanType Dither | ( | const Image * | image,
|  | ViewInfo * | image_view,
|  | CubeInfo * | cube_info,
|  | const unsigned int | direction |
| ) |  |  | `[static]`

static MagickBooleanType DitherImage | ( | Image * | image,
|  | CubeInfo * | cube_info |
| ) |  |  | `[static]`

static CubeInfo* GetCubeInfo | ( | const QuantizeInfo * | quantize_info,
|  | const unsigned long | depth,
|  | const unsigned long | maximum_colors |
| ) |  |  | `[static]`

MagickExport MagickBooleanType GetImageQuantizeError | ( | Image * | image | ) |

static NodeInfo * GetNodeInfo | ( | CubeInfo * | cube_info,
|  | const unsigned long | id,
|  | const unsigned long | level,
|  | NodeInfo * | parent |
| ) |  |  | `[static]`

MagickExport void GetQuantizeInfo | ( | QuantizeInfo * | quantize_info | ) |

static void HilbertCurve | ( | const Image * | image,
|  | ViewInfo * | image_view,
|  | CubeInfo * | cube_info,
|  | const unsigned long | level,
|  | const unsigned int | direction |
| ) |  |  | `[static]`

static MagickBooleanType IsAssociatedAlpha | ( | const Image * | image,
|  | const CubeInfo * | cube_info |
| ) |  |  | `[inline, static]`

static unsigned long MagickMax | ( | const unsigned long | x,
|  | const unsigned long | y |
| ) |  |  | `[inline, static]`

static unsigned long MagickMin | ( | const unsigned long | x,
|  | const unsigned long | y |
| ) |  |  | `[inline, static]`

MagickExport MagickBooleanType MapImage | ( | Image * | image,
|  | const Image * | map_image,
|  | const MagickBooleanType | dither |
| ) |  |  |

MagickExport MagickBooleanType MapImages | ( | Image * | images,
|  | const Image * | map_image,
|  | const MagickBooleanType | dither |
| ) |  |  |

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

static void PruneChild | ( | const Image * | image,
|  | CubeInfo * | cube_info,
|  | const NodeInfo * | node_info |
| ) |  |  | `[static]`

static void PruneLevel | ( | const Image * | image,
|  | CubeInfo * | cube_info,
|  | const NodeInfo * | node_info |
| ) |  |  |

static void PruneToCubeDepth | ( | const Image * | image,
|  | CubeInfo * | cube_info,
|  | const NodeInfo * | node_info |
| ) |  |  |

MagickExport MagickBooleanType QuantizeImage | ( | const QuantizeInfo * | quantize_info,
|  | Image * | image |
| ) |  |  |

MagickExport MagickBooleanType QuantizeImages | ( | const QuantizeInfo * | quantize_info,
|  | Image * | images |
| ) |  |  |

static void Reduce | ( | const Image * | image,
|  | CubeInfo * | cube_info,
|  | const NodeInfo * | node_info |
| ) |  |  | `[static]`

static void ReduceImageColors | ( | const Image * | image,
|  | CubeInfo * | cube_info |
| ) |  |  |