]> 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" 
2   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html version="-//W3C//DTD XHTML 1.1//EN"
4       xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
5       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6       xsi:schemaLocation="http://www.w3.org/1999/xhtml
7                           http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd">
8 <head>
9   <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
10   <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4"/>
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 or 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, PerlMagick, image processing, OpenMP, software development library, image, photo, software, Magick++, MagickWand"/>
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-2012 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" />
31   <link rel="meta" type="application/rdf+xml" title="ICI" href="http://imagemagick.org/ici.rdf"/>
32
33   <!-- Add jQuery library -->
34   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
35   
36   <!-- Add mousewheel plugin (this is optional) -->
37   <script type="text/javascript" src="http://www.imagemagick.org/fancybox/lib/jquery.mousewheel-3.0.6.pack.js"></script>
38   
39   <!-- Add fancyBox -->
40   <link rel="stylesheet" href="http://www.imagemagick.org/fancybox/source/jquery.fancybox.css?v=2.0.6" type="text/css" media="screen" />
41   <script type="text/javascript" src="http://www.imagemagick.org/fancybox/source/jquery.fancybox.pack.js?v=2.0.6"></script>
42   
43   <!-- Optionally add helpers - button, thumbnail and/or media -->
44   <link rel="stylesheet" href="http://www.imagemagick.org/fancybox/source/helpers/jquery.fancybox-buttons.css?v=1.0.2" type="text/css" media="screen" />
45   <script type="text/javascript" src="http://www.imagemagick.org/fancybox/source/helpers/jquery.fancybox-buttons.js?v=1.0.2"></script>
46   <script type="text/javascript" src="http://www.imagemagick.org/fancybox/source/helpers/jquery.fancybox-media.js?v=1.0.0"></script>
47   
48   <link rel="stylesheet" href="http://www.imagemagick.org/fancybox/source/helpers/jquery.fancybox-thumbs.css?v=2.0.6" type="text/css" media="screen" />
49   <script type="text/javascript" src="http://www.imagemagick.org/fancybox/source/helpers/jquery.fancybox-thumbs.js?v=2.0.6"></script>
50   
51   <script type="text/javascript">
52         $(document).ready(function() {
53                 $(".fancybox").fancybox();
54         });
55   </script>
56
57   <!-- ImageMagick style -->
58   <style type="text/css" media="all">
59     @import url("../../www/magick.css");
60   </style>
61 </head>
62
63 <body id="www-imagemagick-org">
64
65 <script>
66   (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
67   (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
68   m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
69   })(window,document,'offline-script','//127.0.0.1/analytics.js','ga');
70
71   ga('create', 'UA-40133312-1', 'imagemagick.org');
72   ga('send', 'pageview');
73 </script>
74
75 <div class="titlebar">
76 <div style="margin: 17px auto; float: left;">
77   <script type="text/javascript">
78   <!--
79     google_ad_client = "pub-3129977114552745";
80     google_ad_slot = "5439289906";
81     google_ad_width = 728;
82     google_ad_height = 90;
83   //-->
84   </script>
85   <script type="text/javascript"
86     src="http://127.0.0.1/pagead/show_ads.js">
87   </script>
88 </div>
89 <a href="http://www.imagemagick.org/discourse-server/">
90   <img src="../../images/logo.jpg"
91   alt="ImageMagick Logo"
92   style="width: 123px; height: 118px; border: 0px; float: right;" /></a>
93 <a href="../../index.html">
94   <img src="../../images/sprite.jpg"
95   alt="ImageMagick Sprite"
96   style="width: 114px; height: 118px; border: 0px; float: right;" /></a>
97 </div>
98
99 <div class="westbar">
100
101 <div class="menu">
102   <a title="About ImageMagick" href="../../index.html">About ImageMagick</a>
103 </div>
104 <div class="menu">
105   <a title="Binary Releases" href="../../www/binary-releases.html">Binary Releases</a>
106 </div>
107 <div class="sub">
108     <a title="Binary Release: Unix" href="../../www/binary-releases.html#unix">Unix</a>
109 </div>
110 <div class="sub">
111     <a title="Binary Release: MacOS X" href="../../www/binary-releases.html#macosx">Mac OS X</a>
112 </div>
113 <div class="sub">
114     <a title="Binary Release: iOS" href="../../www/binary-releases.html#iOS">iOS</a>
115 </div>
116 <div class="sub">
117     <a title="Binary Release: Windows" href="../../www/binary-releases.html#windows">Windows</a>
118 </div>
119 <div class="sep"></div>
120 <div class="menu">
121   <a title="Command-line Tools" href="../../www/command-line-tools.html">Command-line Tools</a>
122 </div>
123 <div class="sub">
124     <a title="Command-line Tools: Processing" href="../../www/command-line-processing.html">Processing</a>
125 </div>
126 <div class="sub">
127     <a title="Command-line Tools: Options" href="../../www/command-line-options.html">Options</a>
128 </div>
129 <div class="sub">
130     <a title="Command-line Tools: Usage" href="http://www.imagemagick.org/Usage/">Usage</a>
131 </div>
132 <div class="menu">
133   <a title="Program Interfaces" href="../../www/api.html">Program Interfaces</a>
134 </div>
135 <div class="sub">
136     <a title="Program Interface: MagickWand" href="../../www/magick-wand.html">MagickWand</a>
137 </div>
138 <div class="sub">
139     <a title="Program Interface: MagickCore" href="../../www/magick-core.html">MagickCore</a>
140 </div>
141 <div class="sub">
142     <a title="Program Interface: PerlMagick" href="../../www/perl-magick.html">PerlMagick</a>
143 </div>
144 <div class="sub">
145     <a title="Program Interface: Magick++" href="../../www/magick++.html">Magick++</a>
146 </div>
147 <div class="sep"></div>
148 <div  class="menu">
149    <a title="Install from Source" href="../../www/install-source.html">Install from Source</a>
150 </div>
151 <div class="sub">
152     <a title="Install from Source: Unix" href="../../www/install-source.html#unix">Unix</a>
153 </div>
154 <div class="sub">
155     <a title="Install from Source: Windows" href="../../www/install-source.html#windows">Windows</a>
156  </div>
157 <div class="menu">
158   <a title="Resources" href="../../www/resources.html">Resources</a>
159 </div>
160 <div class="menu">
161   <a title="Architecture" href="../../www/architecture.html">Architecture</a>
162 </div>
163 <div class="menu">
164   <a title="Download" href="../../www/download.html">Download</a>
165 </div>
166 <div class="sep"></div>
167 <div class="menu">
168   <a title="Search" href="http://www.imagemagick.org/script/search.php">Search</a>
169 </div>
170 <div class="sep"></div>
171 <div class="menu">
172   <a title="Site Map" href="../../www/sitemap.html">Site Map</a>
173 </div>
174 <div  class="sub">
175   <a title="Site Map: Links" href="../../www/links.html">Links</a>
176 </div>
177 <div class="sep"></div>
178 <div class="menu">
179   <a title="Support ImageMagick Development" href="../../www/support.html">Support ImageMagick Development</a>
180 </div>
181 </div>
182
183 <div class="eastbar">
184   <script type="text/javascript">
185     /* <![CDATA[ */
186     (function() {
187         var po = document.createElement('offline-script'), t = document.getElementsByTagName('offline-script')[0];
188         po.type = 'text/javascript';
189         po.async = true;
190         po.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
191         var script = document.getElementsByTagName('offline-script')[0];
192         script.parentNode.insertBefore(po, script);
193     })();
194     /* ]]> */
195   </script>
196   <div> <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://www.imagemagick.org/"></a></div>
197   <noscript>
198     <a href="http://flattr.com/thing/947300/Convert-Edit-And-Compose-Images" target="_blank">
199     <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" width="93" height="20" border="0" /></a>
200   </noscript>
201     <div class="g-plusone" id="gplusone"></div>
202     <script type="text/javascript">
203       /* <![CDATA[ */
204       window.___gcfg = {
205         lang: 'en-US'
206       };
207
208       (function() {
209         var po = document.createElement('offline-script');
210         po.type = 'text/javascript';
211         po.async = true;
212         po.src = 'https://127.0.0.1/js/plusone.js';
213         var script = document.getElementsByTagName('offline-script')[0];
214         script.parentNode.insertBefore(po, script);
215       })();
216       var gplusone = document.getElementById("gplusone");
217       gplusone.setAttribute("data-size","medium");
218       gplusone.setAttribute("data-count","true");
219       /* ]]> */
220     </script>
221 </div>
222
223 <div class="main">
224
225 <h1>Module quantize Methods</h1>
226 <p class="navigation-index">[<a href="quantize.html#QuantizeImage">QuantizeImage</a> &bull; <a href="quantize.html#AcquireQuantizeInfo">AcquireQuantizeInfo</a> &bull; <a href="quantize.html#CloneQuantizeInfo">CloneQuantizeInfo</a> &bull; <a href="quantize.html#CompressImageColormap">CompressImageColormap</a> &bull; <a href="quantize.html#DestroyQuantizeInfo">DestroyQuantizeInfo</a> &bull; <a href="quantize.html#GetImageQuantizeError">GetImageQuantizeError</a> &bull; <a href="quantize.html#GetQuantizeInfo">GetQuantizeInfo</a> &bull; <a href="quantize.html#PosterizeImage">PosterizeImage</a> &bull; <a href="quantize.html#QuantizeImage">QuantizeImage</a> &bull; <a href="quantize.html#QuantizeImages">QuantizeImages</a> &bull; <a href="quantize.html#RemapImage">RemapImage</a> &bull; <a href="quantize.html#RemapImages">RemapImages</a> &bull; <a href="quantize.html#SetGrayscaleImage">SetGrayscaleImage</a>]</p>
227
228 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="QuantizeImage">QuantizeImage</a></h2>
229 <div class="doc-section">
230
231 <p>QuantizeImage() takes a standard RGB or monochrome images and quantizes them down to some fixed number of colors.</p>
232
233 <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>
234
235 <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>
236
237 <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>
238
239 <pre class="text">
240     the origin.
241 </pre>
242
243 <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>
244
245 <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>
246
247 <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>
248
249 <p>A complete tree would require 19,173,961 nodes for k = 8, Cmax = 255.</p>
250 <h5>avoid building a fully populated tree, QUANTIZE</h5>
251 <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>
252
253 <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>
254
255 <pre class="text">
256       n1: Number of pixels whose color is contained in the RGB cube which
257       this node represents;
258 </pre>
259
260 <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>
261
262 <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>
263
264 <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>
265
266 <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>
267
268 <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>
269
270 <p>This has the effect of minimizing any quantization error when merging two nodes together.</p>
271
272 <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>
273
274 <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>
275
276 <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>
277
278 <p>Assignment generates the output image from the pruned tree.  The output</p>
279 <h5>parts</h5>
280 <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>
281
282 <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>
283
284 <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>
285
286 <p>This method is based on a similar algorithm written by Paul Raveling.</p>
287
288  </div>
289 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="AcquireQuantizeInfo">AcquireQuantizeInfo</a></h2>
290 <div class="doc-section">
291
292 <p>AcquireQuantizeInfo() allocates the QuantizeInfo structure.</p>
293
294 <p>The format of the AcquireQuantizeInfo method is:</p>
295
296 <pre class="code">
297   QuantizeInfo *AcquireQuantizeInfo(const ImageInfo *image_info)
298 </pre>
299
300 <p>A description of each parameter follows:</p>
301
302 <h5>image_info</h5>
303 <p>the image info.</p>
304
305  </div>
306 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="CloneQuantizeInfo">CloneQuantizeInfo</a></h2>
307 <div class="doc-section">
308
309 <p>CloneQuantizeInfo() makes a duplicate of the given quantize info structure, or if quantize info is NULL, a new one.</p>
310
311 <p>The format of the CloneQuantizeInfo method is:</p>
312
313 <pre class="code">
314   QuantizeInfo *CloneQuantizeInfo(const QuantizeInfo *quantize_info)
315 </pre>
316
317 <p>A description of each parameter follows:</p>
318
319 <h5>clone_info</h5>
320 <p>Method CloneQuantizeInfo returns a duplicate of the given quantize info, or if image info is NULL a new one.</p>
321
322 <h5>quantize_info</h5>
323 <p>a structure of type info.</p>
324
325  </div>
326 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="CompressImageColormap">CompressImageColormap</a></h2>
327 <div class="doc-section">
328
329 <p>CompressImageColormap() compresses an image colormap by removing any duplicate or unused color entries.</p>
330
331 <p>The format of the CompressImageColormap method is:</p>
332
333 <pre class="code">
334   MagickBooleanType CompressImageColormap(Image *image)
335 </pre>
336
337 <p>A description of each parameter follows:</p>
338
339 <h5>image</h5>
340 <p>the image.</p>
341
342  </div>
343 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="DestroyQuantizeInfo">DestroyQuantizeInfo</a></h2>
344 <div class="doc-section">
345
346 <p>DestroyQuantizeInfo() deallocates memory associated with an QuantizeInfo structure.</p>
347
348 <p>The format of the DestroyQuantizeInfo method is:</p>
349
350 <pre class="code">
351   QuantizeInfo *DestroyQuantizeInfo(QuantizeInfo *quantize_info)
352 </pre>
353
354 <p>A description of each parameter follows:</p>
355
356 <h5>quantize_info</h5>
357 <p>Specifies a pointer to an QuantizeInfo structure.</p>
358
359  </div>
360 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="GetImageQuantizeError">GetImageQuantizeError</a></h2>
361 <div class="doc-section">
362
363 <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>
364
365 <pre class="text">
366       o mean_error_per_pixel:  This value is the mean error for any single
367   pixel in the image.
368 </pre>
369
370 <h5>normalized_mean_square_error</h5>
371 <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>
372
373 <h5>normalized_maximum_square_error</h5>
374 <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>
375
376 <p>The format of the GetImageQuantizeError method is:</p>
377
378 <pre class="code">
379   MagickBooleanType GetImageQuantizeError(Image *image)
380 </pre>
381
382 <p>A description of each parameter follows.</p>
383
384 <h5>image</h5>
385 <p>the image.</p>
386
387  </div>
388 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="GetQuantizeInfo">GetQuantizeInfo</a></h2>
389 <div class="doc-section">
390
391 <p>GetQuantizeInfo() initializes the QuantizeInfo structure.</p>
392
393 <p>The format of the GetQuantizeInfo method is:</p>
394
395 <pre class="code">
396   GetQuantizeInfo(QuantizeInfo *quantize_info)
397 </pre>
398
399 <p>A description of each parameter follows:</p>
400
401 <h5>quantize_info</h5>
402 <p>Specifies a pointer to a QuantizeInfo structure.</p>
403
404  </div>
405 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="PosterizeImage">PosterizeImage</a></h2>
406 <div class="doc-section">
407
408 <p>PosterizeImage() reduces the image to a limited number of colors for a "poster" effect.</p>
409
410 <p>The format of the PosterizeImage method is:</p>
411
412 <pre class="code">
413   MagickBooleanType PosterizeImage(Image *image,const size_t levels,
414     const MagickBooleanType dither)
415   MagickBooleanType PosterizeImageChannel(Image *image,
416     const ChannelType channel,const size_t levels,
417     const MagickBooleanType dither)
418 </pre>
419
420 <p>A description of each parameter follows:</p>
421
422 <h5>image</h5>
423 <p>Specifies a pointer to an Image structure.</p>
424
425 <h5>levels</h5>
426 <p>Number of color levels allowed in each channel.  Very low values (2, 3, or 4) have the most visible effect.</p>
427
428 <h5>dither</h5>
429 <p>Set this integer value to something other than zero to dither the mapped image.</p>
430
431  </div>
432 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="QuantizeImage">QuantizeImage</a></h2>
433 <div class="doc-section">
434
435 <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>
436
437 <p>The format of the QuantizeImage method is:</p>
438
439 <pre class="code">
440   MagickBooleanType QuantizeImage(const QuantizeInfo *quantize_info,
441     Image *image)
442 </pre>
443
444 <p>A description of each parameter follows:</p>
445
446 <h5>quantize_info</h5>
447 <p>Specifies a pointer to an QuantizeInfo structure.</p>
448
449 <h5>image</h5>
450 <p>the image.</p>
451
452  </div>
453 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="QuantizeImages">QuantizeImages</a></h2>
454 <div class="doc-section">
455
456 <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>
457
458 <p>The format of the QuantizeImages method is:</p>
459
460 <pre class="code">
461   MagickBooleanType QuantizeImages(const QuantizeInfo *quantize_info,
462     Image *images)
463 </pre>
464
465 <p>A description of each parameter follows:</p>
466
467 <h5>quantize_info</h5>
468 <p>Specifies a pointer to an QuantizeInfo structure.</p>
469
470 <h5>images</h5>
471 <p>Specifies a pointer to a list of Image structures.</p>
472
473  </div>
474 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="RemapImage">RemapImage</a></h2>
475 <div class="doc-section">
476
477 <p>RemapImage() replaces the colors of an image with the closest color from a reference image.</p>
478
479 <p>The format of the RemapImage method is:</p>
480
481 <pre class="code">
482   MagickBooleanType RemapImage(const QuantizeInfo *quantize_info,
483     Image *image,const Image *remap_image)
484 </pre>
485
486 <p>A description of each parameter follows:</p>
487
488 <h5>quantize_info</h5>
489 <p>Specifies a pointer to an QuantizeInfo structure.</p>
490
491 <h5>image</h5>
492 <p>the image.</p>
493
494 <h5>remap_image</h5>
495 <p>the reference image.</p>
496
497  </div>
498 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="RemapImages">RemapImages</a></h2>
499 <div class="doc-section">
500
501 <p>RemapImages() replaces the colors of a sequence of images with the closest color from a reference image.</p>
502
503 <p>The format of the RemapImage method is:</p>
504
505 <pre class="code">
506   MagickBooleanType RemapImages(const QuantizeInfo *quantize_info,
507     Image *images,Image *remap_image)
508 </pre>
509
510 <p>A description of each parameter follows:</p>
511
512 <h5>quantize_info</h5>
513 <p>Specifies a pointer to an QuantizeInfo structure.</p>
514
515 <h5>images</h5>
516 <p>the image sequence.</p>
517
518 <h5>remap_image</h5>
519 <p>the reference image.</p>
520
521  </div>
522 <h2><a href="http://www.imagemagick.org/api/MagickCore/quantize_8c.html" id="SetGrayscaleImage">SetGrayscaleImage</a></h2>
523 <div class="doc-section">
524
525 <p>SetGrayscaleImage() converts an image to a PseudoClass grayscale image.</p>
526
527 <p>The format of the SetGrayscaleImage method is:</p>
528
529 <pre class="code">
530   MagickBooleanType SetGrayscaleImage(Image *image)
531 </pre>
532
533 <p>A description of each parameter follows:</p>
534
535 <h5>image</h5>
536 <p>The image.</p>
537
538  </div>
539
540 </div>
541
542 <div id="linkbar">
543     <span id="linkbar-west">&nbsp;</span>
544
545     <span id="linkbar-center">
546       <a href="http://www.imagemagick.org/discourse-server/">Discourse Server</a> &bull;
547       <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Studio</a> &bull;
548       <a href="http://jqmagick.imagemagick.org/">JqMagick</a>
549     </span>
550     <span id="linkbar-east">&nbsp;</span>
551   </div>
552   <div class="footer">
553     <span id="footer-west">&copy; 1999-2013 ImageMagick Studio LLC</span>
554     <span id="footer-east"> <a href="../../www/contact.html">Contact the Wizards</a></span>
555   </div>
556   <div style="clear: both; margin: 0; width: 100%; "></div>
557 </body>
558 </html>