blob: 2f0eb3edb71316aa8c0d61bc08d5cdbea0433faf [file] [log] [blame]
cristy3eaa0ef2010-03-06 20:35:26 +00001<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
cristy2c839602010-04-03 02:32:08 +00003<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
cristy3eaa0ef2010-03-06 20:35:26 +00004<head>
cristy3c98a4f2010-08-13 20:09:41 +00005 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
6 <meta name="verify-v1" content="g222frIIxcQTrvDR3NBRUSKP3AnMNoqxOkIniCEkV7U="/>
cristyffb69ed2010-12-25 00:06:48 +00007 <title>ImageMagick: MagickCore, C API for ImageMagick: Reduce the Number of Unique Colors in an Image</title>
cristy3ed852e2009-09-05 21:47:34 +00008 <meta http-equiv="Content-Language" content="en-US"/>
9 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
10 <meta http-equiv="Reply-to" content="magick-users@imagemagick.org"/>
cristy3c98a4f2010-08-13 20:09:41 +000011 <meta name="Application-name" content="ImageMagick"/>
cristyffb69ed2010-12-25 00:06:48 +000012 <meta name="Description" content="ImageMagick is a software suite to create, edit, or compose bitmap images in a variety of formats. Use ImageMagick to scale, rotate, shear, distort and transform images."/>
cristy3c98a4f2010-08-13 20:09:41 +000013 <meta name="Application-url" content="http://www.imagemagick.org"/>
cristy3ed852e2009-09-05 21:47:34 +000014 <meta name="Generator" content="PHP"/>
15 <meta name="Keywords" content="magickcore, c, api, for, imagemagick:, reduce, the, number, of, unique, colors, in, an, image, ImageMagick, ImageMagic, MagickCore, MagickWand, PerlMagick, Magick++, RMagick, PythonMagick, JMagick, TclMagick, Image, Magick, Magic, Wand, ImageMagickObject, Swiss, Army, Knife, Image, Processing"/>
cristy3ed852e2009-09-05 21:47:34 +000016 <meta name="Rating" content="GENERAL"/>
17 <meta name="Robots" content="INDEX, FOLLOW"/>
18 <meta name="Generator" content="ImageMagick Studio LLC"/>
19 <meta name="Author" content="ImageMagick Studio LLC"/>
20 <meta name="Revisit-after" content="2 DAYS"/>
21 <meta name="Resource-type" content="document"/>
cristy4103d562010-12-10 01:38:54 +000022 <meta name="Copyright" content="Copyright (c) 1999-2011 ImageMagick Studio LLC"/>
cristy3ed852e2009-09-05 21:47:34 +000023 <meta name="Distribution" content="Global"/>
cristy3c98a4f2010-08-13 20:09:41 +000024 <link rel="icon" href="../../images/wand.png" sizes="32x32"/>
25 <link rel="shortcut icon" href="../../images/wand.ico" type="images/x-icon"/>
26 <link rel="meta" type="application/rdf+xml" title="ICI" href="http://imagemagick.org/ici.rdf"/>
27 <style type="text/css" media="all">
28 @import url("../../www/magick.css");
29 </style>
cristy3eaa0ef2010-03-06 20:35:26 +000030</head>
31
32<body id="www-imagemagick-org">
33<div class="titlebar">
34<a href="../../index.html">
35 <img src="../../images/script.png" alt="[ImageMagick]"
36 style="width: 350px; height: 60px; margin: 28px auto; float: left;" /></a>
37<a href="http://www.networkredux.com">
38 <img src="../../images/networkredux.png" alt="[sponsor]"
39 style="margin: 45px auto; border: 0px; float: left;" /></a>
40<a href="http://www.imagemagick.org/discourse-server/">
41 <img src="../../images/logo.jpg" alt=""
42 style="width: 114px; height: 118px; border: 0px; float: right;" /></a>
43<a href="../../index.html">
44 <img src="../../images/sprite.jpg" alt=""
45 style="width: 114px; height: 118px; border: 0px; float: right;" /></a>
46</div>
47
cristyce69bb02010-07-27 19:49:46 +000048<div class="westbar">
cristy3eaa0ef2010-03-06 20:35:26 +000049
cristy3ed852e2009-09-05 21:47:34 +000050<div class="menu">
cristy83a272e2010-05-07 20:40:35 +000051 <a title="About ImageMagick" href="../../index.html">About ImageMagick</a>
cristy3ed852e2009-09-05 21:47:34 +000052</div>
cristy3eaa0ef2010-03-06 20:35:26 +000053<div class="sep"></div>
cristy3ed852e2009-09-05 21:47:34 +000054<div class="menu">
cristybb503372010-05-27 20:51:26 +000055 <a title="Binary Releases" href="../../www/binary-releases.html">Binary Releases</a>
56</div>
57<div class="sub">
58 <a title="Binary Release: Unix" href="../../www/binary-releases.html#unix">Unix</a>
59</div>
60<div class="sub">
61 <a title="Binary Release: MacOS X" href="../../www/binary-releases.html#macosx">Mac OS X</a>
62</div>
63<div class="sub">
64 <a title="Binary Release: Windows" href="../../www/binary-releases.html#windows">Windows</a>
65</div>
66<div class="sep"></div>
67<div class="menu">
cristy83a272e2010-05-07 20:40:35 +000068 <a title="Command-line Tools" href="../../www/command-line-tools.html">Command-line Tools</a>
cristy3ed852e2009-09-05 21:47:34 +000069</div>
70<div class="sub">
cristy83a272e2010-05-07 20:40:35 +000071 <a title="Command-line Tools: Processing" href="../../www/command-line-processing.html">Processing</a>
cristy3ed852e2009-09-05 21:47:34 +000072</div>
73<div class="sub">
cristy83a272e2010-05-07 20:40:35 +000074 <a title="Command-line Tools: Options" href="../../www/command-line-options.html">Options</a>
cristy3ed852e2009-09-05 21:47:34 +000075</div>
76<div class="sub">
cristy83a272e2010-05-07 20:40:35 +000077 <a title="Command-line Tools: Usage" href="http://www.imagemagick.org/Usage/">Usage</a>
cristy3ed852e2009-09-05 21:47:34 +000078</div>
79<div class="menu">
cristy83a272e2010-05-07 20:40:35 +000080 <a title="Program Interfaces" href="../../www/api.html">Program Interfaces</a>
cristy3ed852e2009-09-05 21:47:34 +000081</div>
82<div class="sub">
cristy83a272e2010-05-07 20:40:35 +000083 <a title="Program Interface: MagickWand" href="../../www/magick-wand.html">MagickWand</a>
cristy3ed852e2009-09-05 21:47:34 +000084</div>
85<div class="sub">
cristy83a272e2010-05-07 20:40:35 +000086 <a title="Program Interface: MagickCore" href="../../www/magick-core.html">MagickCore</a>
cristy3ed852e2009-09-05 21:47:34 +000087</div>
88<div class="sub">
cristy83a272e2010-05-07 20:40:35 +000089 <a title="Program Interface: PerlMagick" href="../../www/perl-magick.html">PerlMagick</a>
cristy3ed852e2009-09-05 21:47:34 +000090</div>
91<div class="sub">
cristy83a272e2010-05-07 20:40:35 +000092 <a title="Program Interface: Magick++" href="../../Magick++/">Magick++</a>
cristy3ed852e2009-09-05 21:47:34 +000093</div>
cristy3eaa0ef2010-03-06 20:35:26 +000094<div class="sep"></div>
cristy3ed852e2009-09-05 21:47:34 +000095<div class="menu">
cristy83a272e2010-05-07 20:40:35 +000096 <a title="Install from Source" href="../../www/install-source.html">Install from Source</a>
cristy3ed852e2009-09-05 21:47:34 +000097</div>
98<div class="sub">
cristy83a272e2010-05-07 20:40:35 +000099 <a title="Install from Source: Unix" href="../../www/install-source.html#unix">Unix</a>
cristy3ed852e2009-09-05 21:47:34 +0000100</div>
101<div class="sub">
cristy83a272e2010-05-07 20:40:35 +0000102 <a title="Install from Source: Windows" href="../../www/install-source.html#windows">Windows</a>
cristy3ed852e2009-09-05 21:47:34 +0000103 </div>
104<div class="menu">
cristy83a272e2010-05-07 20:40:35 +0000105 <a title="Resources" href="../../www/resources.html">Resources</a>
cristy3ed852e2009-09-05 21:47:34 +0000106</div>
cristybb503372010-05-27 20:51:26 +0000107<div class="menu">
108 <a title="Architecture" href="../../www/architecture.html">Architecture</a>
109</div>
cristy3ed852e2009-09-05 21:47:34 +0000110<div class="menu">
cristy83a272e2010-05-07 20:40:35 +0000111 <a title="Download" href="../../www/download.html">Download</a>
cristy3ed852e2009-09-05 21:47:34 +0000112</div>
cristy3eaa0ef2010-03-06 20:35:26 +0000113<div class="sep"></div>
cristy3ed852e2009-09-05 21:47:34 +0000114<div class="menu">
cristy83a272e2010-05-07 20:40:35 +0000115 <a title="Search" href="../http://www.imagemagick.org/script/search.php">Search</a>
cristy3ed852e2009-09-05 21:47:34 +0000116</div>
cristy3eaa0ef2010-03-06 20:35:26 +0000117<div class="sep"></div>
cristy3ed852e2009-09-05 21:47:34 +0000118<div class="menu">
cristyffb69ed2010-12-25 00:06:48 +0000119 <a title="Site Map" href="../../www/sitemap.html">Site Map</a>
cristy3ed852e2009-09-05 21:47:34 +0000120</div>
121<div class="sub">
cristyffb69ed2010-12-25 00:06:48 +0000122 <a title="Site Map: Links" href="../../www/links.html">Links</a>
cristy3ed852e2009-09-05 21:47:34 +0000123</div>
cristy3eaa0ef2010-03-06 20:35:26 +0000124<div class="sep"></div>
cristy3ed852e2009-09-05 21:47:34 +0000125<div class="menu">
cristy83a272e2010-05-07 20:40:35 +0000126 <a title="Sponsors" href="../../www/sponsors.html">Sponsors:</a>
cristy3ed852e2009-09-05 21:47:34 +0000127
128<div class="sponsbox">
129<div class="sponsor">
cristy307ba182010-12-25 01:00:34 +0000130 <a title="Sponsor: Notebook Reparatur Berlin" href="http://www.notebook-reparaturen-berlin.de">Notebook Reparatur Berlin</a><!-- 2011040100025 gabi.schulze-->
cristy5c4585b2010-11-11 00:13:57 +0000131</div>
132<div class="sponsor">
cristy7d52cd62010-10-01 17:26:59 +0000133 <a title="Sponsor: Druckerei" href="http://print24.com/de/">Druckerei</a><!-- 201110010720 -->
134</div>
135<div class="sponsor">
cristyc5baf4f2010-08-31 15:05:33 +0000136 <a title="Sponsor: Image Converter" href="http://www.batchphoto.com">Image Converter</a><!-- 201103010900 Bits Coffee-->
137</div>
138<div class="sponsor">
cristy851dbce2010-08-06 21:40:00 +0000139 <a title="Sponsor: Flyer drucken" href="http://www.online-druck.biz">Flyer drucken</a><!-- 201109010900 Floeter-->
140</div>
141<div class="sponsor">
cristy83a272e2010-05-07 20:40:35 +0000142 <a title="Sponsor: Webdesign Agentur" href="http://www.ventzke-partner.de">Webdesign Agentur</a><!-- 201101010480 invendio.de-->
cristy9b5852d2010-03-08 18:18:01 +0000143</div>
144<div class="sponsor">
cristy83a272e2010-05-07 20:40:35 +0000145 <a title="Sponsor: LVM Versicherung" href="http://www.neu-reich.de">LVM Versicherung</a><!-- 201101010480 -->
cristy8f900122010-03-05 15:26:31 +0000146</div>
147<div class="sponsor">
cristyc5baf4f2010-08-31 15:05:33 +0000148 <a title="Sponsor: Diamonds are a Girls Best Friend" href="http://www.schmuck.org">Diamonds are a Girls Best Friend</a><!-- 201101010600 Peterssen-->
cristyb4c03bb2009-09-27 13:55:46 +0000149</div>
cristy3ed852e2009-09-05 21:47:34 +0000150</div>
151</div>
cristyce69bb02010-07-27 19:49:46 +0000152</div>
cristy3eaa0ef2010-03-06 20:35:26 +0000153
cristyce69bb02010-07-27 19:49:46 +0000154<div class="eastbar">
155 <script type="text/javascript">
156 <!--
157 google_ad_client = "pub-3129977114552745";
cristyce69bb02010-07-27 19:49:46 +0000158 google_ad_slot = "0574824969";
159 google_ad_width = 160;
160 google_ad_height = 600;
161 //-->
162 </script>
163 <script type="text/javascript"
164 src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
165 </script>
cristy3eaa0ef2010-03-06 20:35:26 +0000166</div>
167
168<div class="main">
169
cristy307ba182010-12-25 01:00:34 +0000170<h1>Module quantize
171 Methods</h1>
cristy3ed852e2009-09-05 21:47:34 +0000172<p class="navigation-index">[<a href="#QuantizeImage">QuantizeImage</a> &bull; <a href="#AcquireQuantizeInfo">AcquireQuantizeInfo</a> &bull; <a href="#CloneQuantizeInfo">CloneQuantizeInfo</a> &bull; <a href="#CompressImageColormap">CompressImageColormap</a> &bull; <a href="#DestroyQuantizeInfo">DestroyQuantizeInfo</a> &bull; <a href="#GetImageQuantizeError">GetImageQuantizeError</a> &bull; <a href="#GetQuantizeInfo">GetQuantizeInfo</a> &bull; <a href="#PosterizeImage">PosterizeImage</a> &bull; <a href="#QuantizeImage">QuantizeImage</a> &bull; <a href="#QuantizeImages">QuantizeImages</a> &bull; <a href="#RemapImage">RemapImage</a> &bull; <a href="#RemapImages">RemapImages</a> &bull; <a href="#SetGrayscaleImage">SetGrayscaleImage</a>]</p>
173
174<h2><a href="http://www.imagemagick.org/api/MagickCore/quantize
175_8c.html" target="source" name="QuantizeImage">QuantizeImage</a></h2>
176<div class="doc-section">
177
178<p>QuantizeImage() takes a standard RGB or monochrome images and quantizes them down to some fixed number of colors.</p></ol>
179
180<p>For purposes of color allocation, an image is a set of n pixels, where each pixel is a point in RGB space. RGB space is a 3-dimensional vector space, and each pixel, Pi, is defined by an ordered triple of red, green, and blue coordinates, (Ri, Gi, Bi).</p></ol>
181
182<p>Each primary color component (red, green, or blue) represents an intensity which varies linearly from 0 to a maximum value, Cmax, which corresponds to full saturation of that color. Color allocation is defined over a domain consisting of the cube in RGB space with opposite vertices at (0,0,0) and (Cmax, Cmax, Cmax). QUANTIZE requires Cmax = 255.</p></ol>
183
184<p>The algorithm maps this domain onto a tree in which each node represents a cube within that domain. In the following discussion these cubes are defined by the coordinate of two opposite vertices:</p>
185
186<pre class="text">
187 the origin.
188</pre>
189
190<p>The tree's root node represents the entire domain, (0,0,0) through (Cmax,Cmax,Cmax). Each lower level in the tree is generated by subdividing one node's cube into eight smaller cubes of equal size. This corresponds to bisecting the parent cube with planes passing through the midpoints of each edge.</p></ol>
191
192<p>The basic algorithm operates in three phases: Classification, Reduction, and Assignment. Classification builds a color description tree for the image. Reduction collapses the tree until the number it represents, at most, the number of colors desired in the output image. Assignment defines the output image's color map and sets each pixel's color by restorage_class in the reduced tree. Our goal is to minimize the numerical discrepancies between the original colors and quantized colors (quantization error).</p></ol>
193
194<p>Classification begins by initializing a color description tree of sufficient depth to represent each possible input color in a leaf. However, it is impractical to generate a fully-formed color description tree in the storage_class phase for realistic values of Cmax. If colors components in the input image are quantized to k-bit precision, so that Cmax= 2k-1, the tree would need k levels below the root node to allow representing each possible input color in a leaf. This becomes prohibitive because the tree's total number of nodes is 1 + sum(i=1, k, 8k).</p></ol>
195
196<p>A complete tree would require 19,173,961 nodes for k = 8, Cmax = 255.</p>
197<h5>avoid building a fully populated tree, QUANTIZE</h5>
198<ol><p>(1) Initializes data structures for nodes only as they are needed; (2) Chooses a maximum depth for the tree as a function of the desired number of colors in the output image (currently log2(colormap size)).</p></ol>
199
200<p>For each pixel in the input image, storage_class scans downward from the root of the color description tree. At each level of the tree it identifies the single node which represents a cube in RGB space containing the pixel's color. It updates the following data for each such node:</p>
201
202<pre class="text">
203 n1: Number of pixels whose color is contained in the RGB cube which
204 this node represents;
205</pre>
206
207<p>n2: Number of pixels whose color is not represented in a node at lower depth in the tree; initially, n2 = 0 for all nodes except leaves of the tree.</p></ol>
208
209<p>Sr, Sg, Sb: Sums of the red, green, and blue component values for all pixels not classified at a lower depth. The combination of these sums and n2 will ultimately characterize the mean color of a set of pixels represented by this node.</p></ol>
210
211<p>E: the distance squared in RGB space between each pixel contained within a node and the nodes' center. This represents the quantization error for a node.</p></ol>
212
213<p>Reduction repeatedly prunes the tree until the number of nodes with n2 > 0 is less than or equal to the maximum number of colors allowed in the output image. On any given iteration over the tree, it selects those nodes whose E count is minimal for pruning and merges their color statistics upward. It uses a pruning threshold, Ep, to govern node selection as follows:</p></ol>
214
215<p>Ep = 0 while number of nodes with (n2 > 0) > required maximum number of colors prune all nodes such that E <= Ep Set Ep to minimum E in remaining nodes</p></ol>
216
217<p>This has the effect of minimizing any quantization error when merging two nodes together.</p></ol>
218
219<p>When a node to be pruned has offspring, the pruning procedure invokes itself recursively in order to prune the tree from the leaves upward. n2, Sr, Sg, and Sb in a node being pruned are always added to the corresponding data in that node's parent. This retains the pruned node's color characteristics for later averaging.</p></ol>
220
221<p>For each node, n2 pixels exist for which that node represents the smallest volume in RGB space containing those pixel's colors. When n2 > 0 the node will uniquely define a color in the output image. At the beginning of reduction, n2 = 0 for all nodes except a the leaves of the tree which represent colors present in the input image.</p></ol>
222
223<p>The other pixel count, n1, indicates the total number of colors within the cubic volume which the node represents. This includes n1 - n2 pixels whose colors should be defined by nodes at a lower level in the tree.</p></ol>
224
225<p>Assignment generates the output image from the pruned tree. The output</p>
226<h5>parts</h5>
227<ol><p>(1) A color map, which is an array of color descriptions (RGB triples) for each color present in the output image; (2) A pixel array, which represents each pixel as an index into the color map array.</p></ol>
228
229<p>First, the assignment phase makes one pass over the pruned color description tree to establish the image's color map. For each node with n2 > 0, it divides Sr, Sg, and Sb by n2 . This produces the mean color of all pixels that classify no lower than this node. Each of these colors becomes an entry in the color map.</p></ol>
230
231<p>Finally, the assignment phase reclassifies each pixel in the pruned tree to identify the deepest node containing the pixel's color. The pixel's value in the pixel array becomes the index of this node's mean color in the color map.</p></ol>
232
233<p>This method is based on a similar algorithm written by Paul Raveling.</p></ol>
234
235 </div>
236<h2><a href="http://www.imagemagick.org/api/MagickCore/quantize
237_8c.html" target="source" name="AcquireQuantizeInfo">AcquireQuantizeInfo</a></h2>
238<div class="doc-section">
239
240<p>AcquireQuantizeInfo() allocates the QuantizeInfo structure.</p></ol>
241
242<p>The format of the AcquireQuantizeInfo method is:</p>
243
244<pre class="code">
245 QuantizeInfo *AcquireQuantizeInfo(const ImageInfo *image_info)
246</pre>
247
248<p>A description of each parameter follows:</p></ol>
249
250<h5>image_info</h5>
251<ol><p>the image info.</p></ol>
252
253 </div>
254<h2><a href="http://www.imagemagick.org/api/MagickCore/quantize
255_8c.html" target="source" name="CloneQuantizeInfo">CloneQuantizeInfo</a></h2>
256<div class="doc-section">
257
258<p>CloneQuantizeInfo() makes a duplicate of the given quantize info structure, or if quantize info is NULL, a new one.</p></ol>
259
260<p>The format of the CloneQuantizeInfo method is:</p>
261
262<pre class="code">
263 QuantizeInfo *CloneQuantizeInfo(const QuantizeInfo *quantize_info)
264</pre>
265
266<p>A description of each parameter follows:</p></ol>
267
268<h5>clone_info</h5>
269<ol><p>Method CloneQuantizeInfo returns a duplicate of the given quantize info, or if image info is NULL a new one.</p></ol>
270
271<h5>quantize_info</h5>
272<ol><p>a structure of type info.</p></ol>
273
274 </div>
275<h2><a href="http://www.imagemagick.org/api/MagickCore/quantize
276_8c.html" target="source" name="CompressImageColormap">CompressImageColormap</a></h2>
277<div class="doc-section">
278
279<p>CompressImageColormap() compresses an image colormap by removing any duplicate or unused color entries.</p></ol>
280
281<p>The format of the CompressImageColormap method is:</p>
282
283<pre class="code">
284 MagickBooleanType CompressImageColormap(Image *image)
285</pre>
286
287<p>A description of each parameter follows:</p></ol>
288
289<h5>image</h5>
290<ol><p>the image.</p></ol>
291
292 </div>
293<h2><a href="http://www.imagemagick.org/api/MagickCore/quantize
294_8c.html" target="source" name="DestroyQuantizeInfo">DestroyQuantizeInfo</a></h2>
295<div class="doc-section">
296
297<p>DestroyQuantizeInfo() deallocates memory associated with an QuantizeInfo structure.</p></ol>
298
299<p>The format of the DestroyQuantizeInfo method is:</p>
300
301<pre class="code">
302 QuantizeInfo *DestroyQuantizeInfo(QuantizeInfo *quantize_info)
303</pre>
304
305<p>A description of each parameter follows:</p></ol>
306
307<h5>quantize_info</h5>
308<ol><p>Specifies a pointer to an QuantizeInfo structure.</p></ol>
309
310 </div>
311<h2><a href="http://www.imagemagick.org/api/MagickCore/quantize
312_8c.html" target="source" name="GetImageQuantizeError">GetImageQuantizeError</a></h2>
313<div class="doc-section">
314
315<p>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:</p>
316
317<pre class="text">
318 o mean_error_per_pixel: This value is the mean error for any single
319 pixel in the image.
320</pre>
321
322<h5>normalized_mean_square_error</h5>
323<ol><p>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.</p></ol>
324
325<h5>normalized_maximum_square_error</h5>
326<ol><p>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.</p></ol>
327
328<p>The format of the GetImageQuantizeError method is:</p>
329
330<pre class="code">
331 MagickBooleanType GetImageQuantizeError(Image *image)
332</pre>
333
334<p>A description of each parameter follows.</p></ol>
335
336<h5>image</h5>
337<ol><p>the image.</p></ol>
338
339 </div>
340<h2><a href="http://www.imagemagick.org/api/MagickCore/quantize
341_8c.html" target="source" name="GetQuantizeInfo">GetQuantizeInfo</a></h2>
342<div class="doc-section">
343
344<p>GetQuantizeInfo() initializes the QuantizeInfo structure.</p></ol>
345
346<p>The format of the GetQuantizeInfo method is:</p>
347
348<pre class="code">
349 GetQuantizeInfo(QuantizeInfo *quantize_info)
350</pre>
351
352<p>A description of each parameter follows:</p></ol>
353
354<h5>quantize_info</h5>
355<ol><p>Specifies a pointer to a QuantizeInfo structure.</p></ol>
356
357 </div>
358<h2><a href="http://www.imagemagick.org/api/MagickCore/quantize
359_8c.html" target="source" name="PosterizeImage">PosterizeImage</a></h2>
360<div class="doc-section">
361
362<p>PosterizeImage() reduces the image to a limited number of colors for a "poster" effect.</p></ol>
363
364<p>The format of the PosterizeImage method is:</p>
365
366<pre class="code">
cristybb503372010-05-27 20:51:26 +0000367 MagickBooleanType PosterizeImage(Image *image,const size_t levels,
cristy3ed852e2009-09-05 21:47:34 +0000368 const MagickBooleanType dither)
369</pre>
370
371<p>A description of each parameter follows:</p></ol>
372
373<h5>image</h5>
374<ol><p>Specifies a pointer to an Image structure.</p></ol>
375
376<h5>levels</h5>
377<ol><p>Number of color levels allowed in each channel. Very low values (2, 3, or 4) have the most visible effect.</p></ol>
378
379<h5>dither</h5>
380<ol><p>Set this integer value to something other than zero to dither the mapped image.</p></ol>
381
382 </div>
383<h2><a href="http://www.imagemagick.org/api/MagickCore/quantize
384_8c.html" target="source" name="QuantizeImage">QuantizeImage</a></h2>
385<div class="doc-section">
386
387<p>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.</p></ol>
388
389<p>The format of the QuantizeImage method is:</p>
390
391<pre class="code">
392 MagickBooleanType QuantizeImage(const QuantizeInfo *quantize_info,
393 Image *image)
394</pre>
395
396<p>A description of each parameter follows:</p></ol>
397
398<h5>quantize_info</h5>
399<ol><p>Specifies a pointer to an QuantizeInfo structure.</p></ol>
400
401<h5>image</h5>
402<ol><p>the image.</p></ol>
403
404 </div>
405<h2><a href="http://www.imagemagick.org/api/MagickCore/quantize
406_8c.html" target="source" name="QuantizeImages">QuantizeImages</a></h2>
407<div class="doc-section">
408
409<p>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.</p></ol>
410
411<p>The format of the QuantizeImages method is:</p>
412
413<pre class="code">
414 MagickBooleanType QuantizeImages(const QuantizeInfo *quantize_info,
415 Image *images)
416</pre>
417
418<p>A description of each parameter follows:</p></ol>
419
420<h5>quantize_info</h5>
421<ol><p>Specifies a pointer to an QuantizeInfo structure.</p></ol>
422
423<h5>images</h5>
424<ol><p>Specifies a pointer to a list of Image structures.</p></ol>
425
426 </div>
427<h2><a href="http://www.imagemagick.org/api/MagickCore/quantize
428_8c.html" target="source" name="RemapImage">RemapImage</a></h2>
429<div class="doc-section">
430
431<p>RemapImage() replaces the colors of an image with the closest color from a reference image.</p></ol>
432
433<p>The format of the RemapImage method is:</p>
434
435<pre class="code">
436 MagickBooleanType RemapImage(const QuantizeInfo *quantize_info,
437 Image *image,const Image *remap_image)
438</pre>
439
440<p>A description of each parameter follows:</p></ol>
441
442<h5>quantize_info</h5>
443<ol><p>Specifies a pointer to an QuantizeInfo structure.</p></ol>
444
445<h5>image</h5>
446<ol><p>the image.</p></ol>
447
448<h5>remap_image</h5>
449<ol><p>the reference image.</p></ol>
450
451 </div>
452<h2><a href="http://www.imagemagick.org/api/MagickCore/quantize
453_8c.html" target="source" name="RemapImages">RemapImages</a></h2>
454<div class="doc-section">
455
456<p>RemapImages() replaces the colors of a sequence of images with the closest color from a reference image.</p></ol>
457
458<p>The format of the RemapImage method is:</p>
459
460<pre class="code">
461 MagickBooleanType RemapImages(const QuantizeInfo *quantize_info,
462 Image *images,Image *remap_image)
463</pre>
464
465<p>A description of each parameter follows:</p></ol>
466
467<h5>quantize_info</h5>
468<ol><p>Specifies a pointer to an QuantizeInfo structure.</p></ol>
469
470<h5>images</h5>
471<ol><p>the image sequence.</p></ol>
472
473<h5>remap_image</h5>
474<ol><p>the reference image.</p></ol>
475
476 </div>
477<h2><a href="http://www.imagemagick.org/api/MagickCore/quantize
478_8c.html" target="source" name="SetGrayscaleImage">SetGrayscaleImage</a></h2>
479<div class="doc-section">
480
481<p>SetGrayscaleImage() converts an image to a PseudoClass grayscale image.</p></ol>
482
483<p>The format of the SetGrayscaleImage method is:</p>
484
485<pre class="code">
486 MagickBooleanType SetGrayscaleImage(Image *image)
487</pre>
488
489<p>A description of each parameter follows:</p></ol>
490
491<h5>image</h5>
492<ol><p>The image.</p></ol>
493
494 </div>
cristy3eaa0ef2010-03-06 20:35:26 +0000495
496</div>
497
498<div id="linkbar">
cristyce69bb02010-07-27 19:49:46 +0000499 <span id="linkbar-west">&nbsp;</span>
cristy3eaa0ef2010-03-06 20:35:26 +0000500 <span id="linkbar-center">
501 <a href="http://www.imagemagick.org/discourse-server/">Discourse Server</a> &bull;
cristya8902942010-07-30 00:49:52 +0000502 <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Studio</a>
cristy3eaa0ef2010-03-06 20:35:26 +0000503 </span>
504 <span id="linkbar-east">&nbsp;</span>
505 </div>
506 <div class="footer">
cristy4103d562010-12-10 01:38:54 +0000507 <span id="footer-west">&copy; 1999-2011 ImageMagick Studio LLC</span>
cristy3eaa0ef2010-03-06 20:35:26 +0000508 <span id="footer-east"> <a href="../http://www.imagemagick.org/script/contact.php">Contact the Wizards</a></span>
509 </div>
510 <div style="clear: both; margin: 0; width: 100%; "></div>
cristya8902942010-07-30 00:49:52 +0000511 <script type="text/javascript">
512 var _gaq = _gaq || [];
513 _gaq.push(['_setAccount', 'UA-17690367-1']);
514 _gaq.push(['_trackPageview']);
515
516 (function() {
517 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
518 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
519 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
520 })();
521 </script>
cristy3eaa0ef2010-03-06 20:35:26 +0000522</body>
523</html>