]> granicus.if.org Git - imagemagick/blob - www/api/quantize.html
(no commit message)
[imagemagick] / www / api / quantize.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" \r
2   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
3 <html version="-//W3C//DTD XHTML 1.1//EN"\r
4       xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"\r
5       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
6       xsi:schemaLocation="http://www.w3.org/1999/xhtml\r
7                           http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd">\r
8 <head>\r
9   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>\r
10   <meta name="google-site-verification" content="MxsMq6bdLOx0KSuz1MY6yG9ZTIJ7_7DVRfl5NCAT5Yg"/>\r
11   <title>ImageMagick: MagickCore, C API for ImageMagick: Reduce the Number of Unique Colors in an Image</title>
12   <meta http-equiv="Content-Language" content="en-US"/>
13   <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
14   <meta http-equiv="Reply-to" content="magick-users@imagemagick.org"/>
15   <meta name="Application-name" content="ImageMagick"/>
16   <meta name="Description" content="Use ImageMagick to convert, edit, or compose bitmap images in a variety of formats.  In addition resize, rotate, shear, distort and transform images automagically."/>
17   <meta name="Application-url" content="http://www.imagemagick.org"/>
18   <meta name="Generator" content="PHP"/>
19   <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, Image, Processing, Automagically"/>
20   <meta name="Rating" content="GENERAL"/>
21   <meta name="Robots" content="INDEX, FOLLOW"/>
22   <meta name="Generator" content="ImageMagick Studio LLC"/>
23   <meta name="Author" content="ImageMagick Studio LLC"/>
24   <meta name="Revisit-after" content="2 DAYS"/>
25   <meta name="Resource-type" content="document"/>
26   <meta name="Copyright" content="Copyright (c) 1999-2011 ImageMagick Studio LLC"/>
27   <meta name="Distribution" content="Global"/>
28   <link rel="icon" href="../../images/wand.png"/>
29   <link rel="shortcut icon" href="../../images/wand.ico"  type="images/x-icon"/>
30   <link rel="canonical" href="http://www.imagemagick.org" />\r
31   <link rel="meta" type="application/rdf+xml" title="ICI" href="http://imagemagick.org/ici.rdf"/>\r
32   <link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" />\r
33   <link rel="stylesheet" type="text/css" href="http://www.imagemagick.org/fancybox/jquery.fancybox-1.3.4.css" media="screen" />\r
34   <style type="text/css" media="all">\r
35     @import url("../../www/magick.css");\r
36   </style>\r
37   <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>\r
38   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>\r
39   <script type="text/javascript" src="http://www.imagemagick.org/fancybox/jquery.fancybox-1.3.4.pack.js"></script>\r
40   <script type="text/javascript">\r
41     $(document).ready(function() {\r
42       $("a[href$=.jpg],a[href$=.png],a[href$=.gif]").fancybox({\r
43         'transitionIn'  : 'elastic',\r
44         'transitionOut' : 'elastic',\r
45         'overlayShow'   : false,\r
46         'opacity'       : true\r
47       });\r
48     });\r
49   </script>\r
50 </head>\r
51 \r
52 <body id="www-imagemagick-org">\r
53 <div class="titlebar">\r
54 <div style="margin: 17px auto; float: left;">\r
55   <script type="text/javascript">\r
56   <!--\r
57     google_ad_client = "pub-3129977114552745";\r
58     google_ad_slot = "5439289906";\r
59     google_ad_width = 728;\r
60     google_ad_height = 90;\r
61   //-->\r
62   </script>\r
63   <script type="text/javascript"\r
64     src="http://pagead2.googlesyndication.com/pagead/show_ads.js">\r
65   </script>\r
66 </div>\r
67 <a href="http://www.imagemagick.org/discourse-server/">\r
68   <img src="../../images/logo.jpg"\r
69   alt="ImageMagick Logo"\r
70   style="width: 123px; height: 118px; border: 0px; float: right;" /></a>\r
71 <a href="../../index.html">\r
72   <img src="../../images/sprite.jpg"\r
73   alt="ImageMagick Sprite"\r
74   style="width: 114px; height: 118px; border: 0px; float: right;" /></a>\r
75 </div>\r
76 \r
77 <div class="westbar">\r
78 \r
79 <div class="menu">
80   <a title="About ImageMagick" href="../../index.html">About ImageMagick</a>
81 </div>
82 <div class="menu">
83   <a title="Binary Releases" href="../../www/binary-releases.html">Binary Releases</a>
84 </div>
85 <div class="sub">
86     <a title="Binary Release: Unix" href="../../www/binary-releases.html#unix">Unix</a>
87 </div>
88 <div class="sub">
89     <a title="Binary Release: MacOS X" href="../../www/binary-releases.html#macosx">Mac OS X</a>
90 </div>
91 <div class="sub">
92     <a title="Binary Release: iOS" href="../../www/binary-releases.html#iOS">iOS</a>
93 </div>
94 <div class="sub">
95     <a title="Binary Release: Windows" href="../../www/binary-releases.html#windows">Windows</a>
96 </div>
97 <div class="sep"></div>\r
98 <div class="menu">
99   <a title="Command-line Tools" href="../../www/command-line-tools.html">Command-line Tools</a>
100 </div>
101 <div class="sub">
102     <a title="Command-line Tools: Processing" href="../../www/command-line-processing.html">Processing</a>
103 </div>
104 <div class="sub">
105     <a title="Command-line Tools: Options" href="../../www/command-line-options.html">Options</a>
106 </div>
107 <div class="sub">
108     <a title="Command-line Tools: Usage" href="http://www.imagemagick.org/Usage/">Usage</a>
109 </div>
110 <div class="menu">
111   <a title="Program Interfaces" href="../../www/api.html">Program Interfaces</a>
112 </div>
113 <div class="sub">
114     <a title="Program Interface: MagickWand" href="../../www/magick-wand.html">MagickWand</a>
115 </div>
116 <div class="sub">
117     <a title="Program Interface: MagickCore" href="../../www/magick-core.html">MagickCore</a>
118 </div>
119 <div class="sub">
120     <a title="Program Interface: PerlMagick" href="../../www/perl-magick.html">PerlMagick</a>
121 </div>
122 <div class="sub">
123     <a title="Program Interface: Magick++" href="../../www/magick++.html">Magick++</a>
124 </div>
125 <div class="sep"></div>\r
126 <div  class="menu">
127    <a title="Install from Source" href="../../www/install-source.html">Install from Source</a>
128 </div>
129 <div class="sub">
130     <a title="Install from Source: Unix" href="../../www/install-source.html#unix">Unix</a>
131 </div>
132 <div class="sub">
133     <a title="Install from Source: Windows" href="../../www/install-source.html#windows">Windows</a>
134  </div>
135 <div class="menu">
136   <a title="Resources" href="../../www/resources.html">Resources</a>
137 </div>
138 <div class="menu">
139   <a title="Architecture" href="../../www/architecture.html">Architecture</a>
140 </div>
141 <div class="menu">
142   <a title="Download" href="../../www/download.html">Download</a>
143 </div>
144 <div class="sep"></div>\r
145 <div class="menu">
146   <a title="Search" href="../../www/search.html">Search</a>
147 </div>
148 <div class="sep"></div>\r
149 <div class="menu">
150   <a title="Site Map" href="../../www/sitemap.html">Site Map</a>
151 </div>
152 <div  class="sub">
153   <a title="Site Map: Links" href="../../www/links.html">Links</a>
154 </div>
155 <div class="sep"></div>\r
156 <div  class="menu">
157   <a rel="follow" title="Sponsors" href="../../www/sponsors.html">Sponsors:</a>
158
159 <a href="http://www.networkredux.com">
160   <img src="../../images/networkredux.png" alt="[sponsor]"
161   style="margin-top: 4px; margin-left: 4px; border: 0px; float: left;" /></a>
162 <div class="sponsbox">
163 <div  class="sponsor">
164   <a rel="follow" title="Sponsor: Web Hosting" href="http://www.micfo.com">Web Hosting</a><!-- 209901010090s golestan -->
165 </div>
166 <div  class="sponsor">
167   <a rel="follow" title="Sponsor: Autos part" href="http://www.pkwteile.de/autoteile">Autos part</a><!-- 201112010090s jr@pkwte... -->
168 </div>
169 <div  class="sponsor">
170   <a rel="follow" title="Sponsor: Search engine optimisation" href="http://www.seomoves.com.au">Search engine optimisation</a><!-- 201110010090s jen@seo lowprofilelinks -->
171 </div>
172 <div  class="sponsor">
173   <a rel="follow" title="Sponsor: Druckerei" href="http://print24.com/de/">Druckerei</a><!-- 201110010720 -->
174 </div>
175 <div  class="sponsor">
176   <a rel="follow" title="Sponsor: Web Hosting Deals" href="http://www.webhostingdeals.org">Web Hosting Deals</a><!-- 201111010270 chee.hoa darin -->
177 </div>
178 <div  class="sponsor">
179   <a rel="follow" title="Sponsor: Web Hosting Reviews" href="http://www.webhostingsecretrevealed.com">Web Hosting Secret Revealed</a><!-- 201204010540 iamchee jerry -->
180 </div>
181 <div  class="sponsor">
182   <a rel="follow" title="Sponsor: Web Hosting Break" href="http://www.webhostingbreak.com">Web Hosting Break</a><!-- 201109010090 ian@ian-m... -->
183 </div>
184 <div  class="sponsor">
185   <a rel="follow" title="Sponsor: Druckerei" href="http://www.allesdruck.de">Druckerei</a><!-- 201303011500 r.leo -->
186 </div>
187 <div  class="sponsor">
188   <a rel="follow" title="Sponsor: Website Hosting" href="http://www.hostreviewgeeks.com">Website Hosting</a><!-- 201110010090 alexanian media -->
189 </div>
190 <div  class="sponsor">
191   <a rel="follow" title="Sponsor: Hotel München" href="http://www.messehotel-erb-muenchen.de">Hotel München</a><!-- 201111010450 cerb -->
192 </div>
193 <div  class="sponsor">
194   <a rel="follow" title="Sponsor: Best Web Hosting" href="http://webhostinggeeks.com">Best Web Hosting</a><!-- 201110010720 -->
195 </div>
196 <div  class="sponsor">
197   <a rel="follow" title="Sponsor: Flyer drucken" href="http://www.online-druck.biz">Flyer drucken</a><!-- 201109010900 Floeter-->
198 </div>
199 <div  class="sponsor">
200   <a rel="follow" title="Sponsor: Web Hosting Ratings" href="http://webhostingrating.com">Web Hosting Ratings</a><!-- 201110010720 -->
201 </div>
202 <div  class="sponsor">
203    <a rel="follow" title="Sponsor: Bildbearbeitung" href="http://www.bildschliff.de">Bildbearbeitung</a><!-- 2012060100300 strait.de-->
204 </div>
205 </div>
206 </div>
207 </div>\r
208 \r
209 <div class="eastbar">\r
210   <div class="g-plusone" data-size="standard" data-count="false"></div>\r
211 </div>\r
212 \r
213 <div class="main">\r
214 \r
215 <h1>Module quantize Methods</h1>
216 <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>
217
218 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="QuantizeImage">QuantizeImage</a></h2>
219 <div class="doc-section">
220
221 <p>QuantizeImage() takes a standard RGB or monochrome images and quantizes them down to some fixed number of colors.</p>
222
223 <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>
224
225 <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>
226
227 <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>
228
229 <pre class="text">
230     the origin.
231 </pre>
232
233 <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>
234
235 <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>
236
237 <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>
238
239 <p>A complete tree would require 19,173,961 nodes for k = 8, Cmax = 255.</p>
240 <h5>avoid building a fully populated tree, QUANTIZE</h5>
241 <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>
242
243 <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>
244
245 <pre class="text">
246       n1: Number of pixels whose color is contained in the RGB cube which
247       this node represents;
248 </pre>
249
250 <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>
251
252 <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>
253
254 <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>
255
256 <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>
257
258 <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>
259
260 <p>This has the effect of minimizing any quantization error when merging two nodes together.</p>
261
262 <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>
263
264 <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>
265
266 <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>
267
268 <p>Assignment generates the output image from the pruned tree.  The output</p>
269 <h5>parts</h5>
270 <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>
271
272 <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>
273
274 <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>
275
276 <p>This method is based on a similar algorithm written by Paul Raveling.</p>
277
278  </div>
279 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="AcquireQuantizeInfo">AcquireQuantizeInfo</a></h2>
280 <div class="doc-section">
281
282 <p>AcquireQuantizeInfo() allocates the QuantizeInfo structure.</p>
283
284 <p>The format of the AcquireQuantizeInfo method is:</p>
285
286 <pre class="code">
287   QuantizeInfo *AcquireQuantizeInfo(const ImageInfo *image_info)
288 </pre>
289
290 <p>A description of each parameter follows:</p>
291
292 <h5>image_info</h5>
293 <p>the image info.</p>
294
295  </div>
296 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="CloneQuantizeInfo">CloneQuantizeInfo</a></h2>
297 <div class="doc-section">
298
299 <p>CloneQuantizeInfo() makes a duplicate of the given quantize info structure, or if quantize info is NULL, a new one.</p>
300
301 <p>The format of the CloneQuantizeInfo method is:</p>
302
303 <pre class="code">
304   QuantizeInfo *CloneQuantizeInfo(const QuantizeInfo *quantize_info)
305 </pre>
306
307 <p>A description of each parameter follows:</p>
308
309 <h5>clone_info</h5>
310 <p>Method CloneQuantizeInfo returns a duplicate of the given quantize info, or if image info is NULL a new one.</p>
311
312 <h5>quantize_info</h5>
313 <p>a structure of type info.</p>
314
315  </div>
316 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="CompressImageColormap">CompressImageColormap</a></h2>
317 <div class="doc-section">
318
319 <p>CompressImageColormap() compresses an image colormap by removing any duplicate or unused color entries.</p>
320
321 <p>The format of the CompressImageColormap method is:</p>
322
323 <pre class="code">
324   MagickBooleanType CompressImageColormap(Image *image)
325 </pre>
326
327 <p>A description of each parameter follows:</p>
328
329 <h5>image</h5>
330 <p>the image.</p>
331
332  </div>
333 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="DestroyQuantizeInfo">DestroyQuantizeInfo</a></h2>
334 <div class="doc-section">
335
336 <p>DestroyQuantizeInfo() deallocates memory associated with an QuantizeInfo structure.</p>
337
338 <p>The format of the DestroyQuantizeInfo method is:</p>
339
340 <pre class="code">
341   QuantizeInfo *DestroyQuantizeInfo(QuantizeInfo *quantize_info)
342 </pre>
343
344 <p>A description of each parameter follows:</p>
345
346 <h5>quantize_info</h5>
347 <p>Specifies a pointer to an QuantizeInfo structure.</p>
348
349  </div>
350 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="GetImageQuantizeError">GetImageQuantizeError</a></h2>
351 <div class="doc-section">
352
353 <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>
354
355 <pre class="text">
356       o mean_error_per_pixel:  This value is the mean error for any single
357   pixel in the image.
358 </pre>
359
360 <h5>normalized_mean_square_error</h5>
361 <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>
362
363 <h5>normalized_maximum_square_error</h5>
364 <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>
365
366 <p>The format of the GetImageQuantizeError method is:</p>
367
368 <pre class="code">
369   MagickBooleanType GetImageQuantizeError(Image *image)
370 </pre>
371
372 <p>A description of each parameter follows.</p>
373
374 <h5>image</h5>
375 <p>the image.</p>
376
377  </div>
378 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="GetQuantizeInfo">GetQuantizeInfo</a></h2>
379 <div class="doc-section">
380
381 <p>GetQuantizeInfo() initializes the QuantizeInfo structure.</p>
382
383 <p>The format of the GetQuantizeInfo method is:</p>
384
385 <pre class="code">
386   GetQuantizeInfo(QuantizeInfo *quantize_info)
387 </pre>
388
389 <p>A description of each parameter follows:</p>
390
391 <h5>quantize_info</h5>
392 <p>Specifies a pointer to a QuantizeInfo structure.</p>
393
394  </div>
395 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="PosterizeImage">PosterizeImage</a></h2>
396 <div class="doc-section">
397
398 <p>PosterizeImage() reduces the image to a limited number of colors for a "poster" effect.</p>
399
400 <p>The format of the PosterizeImage method is:</p>
401
402 <pre class="code">
403   MagickBooleanType PosterizeImage(Image *image,const size_t levels,
404     const MagickBooleanType dither)
405 </pre>
406
407 <p>A description of each parameter follows:</p>
408
409 <h5>image</h5>
410 <p>Specifies a pointer to an Image structure.</p>
411
412 <h5>levels</h5>
413 <p>Number of color levels allowed in each channel.  Very low values (2, 3, or 4) have the most visible effect.</p>
414
415 <h5>dither</h5>
416 <p>Set this integer value to something other than zero to dither the mapped image.</p>
417
418  </div>
419 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="QuantizeImage">QuantizeImage</a></h2>
420 <div class="doc-section">
421
422 <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>
423
424 <p>The format of the QuantizeImage method is:</p>
425
426 <pre class="code">
427   MagickBooleanType QuantizeImage(const QuantizeInfo *quantize_info,
428     Image *image)
429 </pre>
430
431 <p>A description of each parameter follows:</p>
432
433 <h5>quantize_info</h5>
434 <p>Specifies a pointer to an QuantizeInfo structure.</p>
435
436 <h5>image</h5>
437 <p>the image.</p>
438
439  </div>
440 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="QuantizeImages">QuantizeImages</a></h2>
441 <div class="doc-section">
442
443 <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>
444
445 <p>The format of the QuantizeImages method is:</p>
446
447 <pre class="code">
448   MagickBooleanType QuantizeImages(const QuantizeInfo *quantize_info,
449     Image *images)
450 </pre>
451
452 <p>A description of each parameter follows:</p>
453
454 <h5>quantize_info</h5>
455 <p>Specifies a pointer to an QuantizeInfo structure.</p>
456
457 <h5>images</h5>
458 <p>Specifies a pointer to a list of Image structures.</p>
459
460  </div>
461 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="RemapImage">RemapImage</a></h2>
462 <div class="doc-section">
463
464 <p>RemapImage() replaces the colors of an image with the closest color from a reference image.</p>
465
466 <p>The format of the RemapImage method is:</p>
467
468 <pre class="code">
469   MagickBooleanType RemapImage(const QuantizeInfo *quantize_info,
470     Image *image,const Image *remap_image)
471 </pre>
472
473 <p>A description of each parameter follows:</p>
474
475 <h5>quantize_info</h5>
476 <p>Specifies a pointer to an QuantizeInfo structure.</p>
477
478 <h5>image</h5>
479 <p>the image.</p>
480
481 <h5>remap_image</h5>
482 <p>the reference image.</p>
483
484  </div>
485 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="RemapImages">RemapImages</a></h2>
486 <div class="doc-section">
487
488 <p>RemapImages() replaces the colors of a sequence of images with the closest color from a reference image.</p>
489
490 <p>The format of the RemapImage method is:</p>
491
492 <pre class="code">
493   MagickBooleanType RemapImages(const QuantizeInfo *quantize_info,
494     Image *images,Image *remap_image)
495 </pre>
496
497 <p>A description of each parameter follows:</p>
498
499 <h5>quantize_info</h5>
500 <p>Specifies a pointer to an QuantizeInfo structure.</p>
501
502 <h5>images</h5>
503 <p>the image sequence.</p>
504
505 <h5>remap_image</h5>
506 <p>the reference image.</p>
507
508  </div>
509 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="SetGrayscaleImage">SetGrayscaleImage</a></h2>
510 <div class="doc-section">
511
512 <p>SetGrayscaleImage() converts an image to a PseudoClass grayscale image.</p>
513
514 <p>The format of the SetGrayscaleImage method is:</p>
515
516 <pre class="code">
517   MagickBooleanType SetGrayscaleImage(Image *image)
518 </pre>
519
520 <p>A description of each parameter follows:</p>
521
522 <h5>image</h5>
523 <p>The image.</p>
524
525  </div>
526 \r
527 </div>\r
528 \r
529 <div id="linkbar">\r
530     <span id="linkbar-west">&nbsp;</span>\r
531     <span id="linkbar-center">\r
532       <a href="http://www.imagemagick.org/discourse-server/">Discourse Server</a> &bull;\r
533       <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Studio</a>\r
534     </span>\r
535     <span id="linkbar-east">&nbsp;</span>\r
536   </div>\r
537   <div class="footer">\r
538     <span id="footer-west">&copy; 1999-2011 ImageMagick Studio LLC</span>\r
539     <span id="footer-east"> <a href="../http://www.imagemagick.org/script/contact.php">Contact the Wizards</a></span>\r
540   </div>\r
541   <div style="clear: both; margin: 0; width: 100%; "></div>\r
542   <script type="text/javascript">\r
543     var _gaq = _gaq || [];\r
544     _gaq.push(['_setAccount', 'UA-17690367-1']);\r
545     _gaq.push(['_trackPageview']);\r
546 \r
547     (function() {\r
548       var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\r
549       ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\r
550       var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\r
551     })();\r
552   </script>\r
553 </body>\r
554 </html>\r