blob: 33e33bf518bb2d79a005fcfd440c9444059fba77 [file] [log] [blame]
cristy29dc8652015-05-12 16:26:21 +00001<!DOCTYPE html>
cristy44443b92015-05-05 00:06:07 +00002<html lang="en">
cristy06f63f22012-10-31 00:50:07 +00003<head>
cristy44443b92015-05-05 00:06:07 +00004 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="viewport" content="width=device-width, initial-scale=1">
cristyffb69ed2010-12-25 00:06:48 +00007 <title>ImageMagick: MagickCore, C API for ImageMagick: Count the Colors in an Image</title>
cristy44443b92015-05-05 00:06:07 +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">
11 <meta name="application-name" content="ImageMagick">
12 <meta name="description" content="ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.">
13 <meta name="application-url" content="http://www.imagemagick.org">
14 <meta name="generator" content="PHP">
15 <meta name="keywords" content="magickcore, c, api, for, imagemagick:, count, the, colors, in, an, image, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert">
16 <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">
cristy4e638cd2015-05-07 16:47:40 +000022 <meta name="copyright" content="Copyright (c) 1999-2015 ImageMagick Studio LLC">
cristy44443b92015-05-05 00:06:07 +000023 <meta name="distribution" content="Global">
24 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1">
cristy2f563d42015-05-06 23:36:51 +000025 <link rel="icon" href="../images/wand.png">
26 <link rel="shortcut icon" href="../images/wand.ico" type="images/x-icon">
27 <link rel="stylesheet" href="../css/bootstrap.min.css">
28 <link rel="stylesheet" href="../css/magick.css">
cristy06f63f22012-10-31 00:50:07 +000029</head>
30
cristy44443b92015-05-05 00:06:07 +000031<body>
cristy06f63f22012-10-31 00:50:07 +000032<div class="main">
cristy44443b92015-05-05 00:06:07 +000033<div class="magick-masthead">
34 <div class="container">
35 <script type="text/javascript">
36 <!--
37 google_ad_client = "pub-3129977114552745";
38 google_ad_slot = "5439289906";
39 google_ad_width = 728;
40 google_ad_height = 90;
41 //-->
42 </script>
43 <center><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
44 </script></center>
45 <nav class="magick-nav">
cristy2f563d42015-05-06 23:36:51 +000046 <a class="magick-nav-item " href="../index.html">Home</a>
cristyea2793e2015-05-31 16:52:26 +000047 <a class="magick-nav-item " href="../binary-releases.html">Download</a>
cristy38185362015-05-07 20:09:56 +000048 <a class="magick-nav-item " href="../command-line-tools.html">Tools</a>
49 <a class="magick-nav-item " href="../command-line-options.html">Options</a>
cristyea2793e2015-05-31 16:52:26 +000050 <a class="magick-nav-item " href="../resources.html">Resources</a>
51 <a class="magick-nav-item " href="api.html">Develop</a>
cristya1890f02015-05-15 23:32:44 +000052 <a class="magick-nav-item " href="http://www.imagemagick.org/script/search.php">Search</a>
53 <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a>
cristy44443b92015-05-05 00:06:07 +000054 </nav>
55 </div>
56</div>
57<div class="container">
cristy4e638cd2015-05-07 16:47:40 +000058<div class="magick-header">
cristy82a2ff22015-05-12 16:41:32 +000059<p class="text-center"><a href="color.html#AcquireColorCache">AcquireColorCache</a><a href="color.html#GetColorInfoList">GetColorInfoList</a><a href="color.html#GetColorList">GetColorList</a><a href="color.html#ListColorInfo">ListColorInfo</a><a href="color.html#QueryColorCompliance">QueryColorCompliance</a><a href="color.html#QueryColorDatabase">QueryColorDatabase</a><a href="color.html#QueryColorname">QueryColorname</a><a href="color.html#QueryMagickColorCompliance">QueryMagickColorCompliance</a><a href="color.html#QueryMagickColor">QueryMagickColor</a><a href="color.html#QueryMagickColorname">QueryMagickColorname</a></p>
cristy06f63f22012-10-31 00:50:07 +000060
cristy44443b92015-05-05 00:06:07 +000061<h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="AcquireColorCache">AcquireColorCache</a></h2>
cristy6f77f692011-02-15 15:31:39 +000062
cristy44443b92015-05-05 00:06:07 +000063<p>AcquireColorCache() caches one or more color configurations which provides a mapping between color attributes and a color name.</p>
64
65<p>The format of the AcquireColorCache method is:</p>
66
67<pre class="text">
68LinkedListInfo *AcquireColorCache(const char *filename,
69 ExceptionInfo *exception)
70</pre>
71
72<p>A description of each parameter follows:</p>
73
74<dd>
75</dd>
76
77<dd> </dd>
78<dl class="dl-horizontal">
79<dt>filename</dt>
80<dd>the font file name. </dd>
81
82<dd> </dd>
83<dt>exception</dt>
84<dd>return any errors or warnings in this structure. </dd>
85
86<dd> </dd>
87</dl>
cristy20398432011-08-11 01:31:50 +000088<h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="GetColorInfoList">GetColorInfoList</a></h2>
cristy20398432011-08-11 01:31:50 +000089
90<p>GetColorInfoList() returns any colors that match the specified pattern.</p>
91
92<p>The format of the GetColorInfoList function is:</p>
93
94<pre class="text">
cristy44443b92015-05-05 00:06:07 +000095const ColorInfo **GetColorInfoList(const char *pattern,
96 size_t *number_colors,ExceptionInfo *exception)
cristy20398432011-08-11 01:31:50 +000097</pre>
98
99<p>A description of each parameter follows:</p>
100
cristy44443b92015-05-05 00:06:07 +0000101<dd>
102</dd>
cristy20398432011-08-11 01:31:50 +0000103
cristy44443b92015-05-05 00:06:07 +0000104<dd> </dd>
105<dl class="dl-horizontal">
106<dt>pattern</dt>
107<dd>Specifies a pointer to a text string containing a pattern. </dd>
cristy20398432011-08-11 01:31:50 +0000108
cristy44443b92015-05-05 00:06:07 +0000109<dd> </dd>
110<dt>number_colors</dt>
111<dd> This integer returns the number of colors in the list. </dd>
cristy20398432011-08-11 01:31:50 +0000112
cristy44443b92015-05-05 00:06:07 +0000113<dd> </dd>
114<dt>exception</dt>
115<dd>return any errors or warnings in this structure. </dd>
116
117<dd> </dd>
118</dl>
cristy20398432011-08-11 01:31:50 +0000119<h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="GetColorList">GetColorList</a></h2>
cristy20398432011-08-11 01:31:50 +0000120
121<p>GetColorList() returns any colors that match the specified pattern.</p>
122
123<p>The format of the GetColorList function is:</p>
124
125<pre class="text">
cristy44443b92015-05-05 00:06:07 +0000126char **GetColorList(const char *pattern,size_t *number_colors,
127 ExceptionInfo *exception)
cristy20398432011-08-11 01:31:50 +0000128</pre>
129
130<p>A description of each parameter follows:</p>
131
cristy44443b92015-05-05 00:06:07 +0000132<dd>
133</dd>
cristy20398432011-08-11 01:31:50 +0000134
cristy44443b92015-05-05 00:06:07 +0000135<dd> </dd>
136<dl class="dl-horizontal">
137<dt>pattern</dt>
138<dd>Specifies a pointer to a text string containing a pattern. </dd>
cristy20398432011-08-11 01:31:50 +0000139
cristy44443b92015-05-05 00:06:07 +0000140<dd> </dd>
141<dt>number_colors</dt>
142<dd> This integer returns the number of colors in the list. </dd>
cristy20398432011-08-11 01:31:50 +0000143
cristy44443b92015-05-05 00:06:07 +0000144<dd> </dd>
145<dt>exception</dt>
146<dd>return any errors or warnings in this structure. </dd>
147
148<dd> </dd>
149</dl>
cristy20398432011-08-11 01:31:50 +0000150<h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="ListColorInfo">ListColorInfo</a></h2>
cristy20398432011-08-11 01:31:50 +0000151
152<p>ListColorInfo() lists color names to the specified file. Color names are a convenience. Rather than defining a color by its red, green, and blue intensities just use a color name such as white, blue, or yellow.</p>
153
154<p>The format of the ListColorInfo method is:</p>
155
cristy44443b92015-05-05 00:06:07 +0000156<pre class="text">
157MagickBooleanType ListColorInfo(FILE *file,ExceptionInfo *exception)
cristy20398432011-08-11 01:31:50 +0000158</pre>
159
160<p>A description of each parameter follows.</p>
161
cristy44443b92015-05-05 00:06:07 +0000162<dt>file</dt>
cristy20398432011-08-11 01:31:50 +0000163<p>List color names to this file handle.</p>
164
cristy44443b92015-05-05 00:06:07 +0000165<dt>exception</dt>
cristy20398432011-08-11 01:31:50 +0000166<p>return any errors or warnings in this structure.</p>
167
cristy82a2ff22015-05-12 16:41:32 +0000168<h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="QueryColorCompliance">QueryColorCompliance</a></h2>
169
170<p>QueryColorCompliance() returns the red, green, blue, and opacity intensities for a given color name.</p>
171
172<p>The format of the QueryColorCompliance method is:</p>
173
174<pre class="text">
175MagickBooleanType QueryColorCompliance(const char *name,
176 const ComplianceType compliance,PixelPacket *color,
177 ExceptionInfo *exception)
178</pre>
179
180<p>A description of each parameter follows:</p>
181
182<dd>
183</dd>
184
185<dd> </dd>
186<dl class="dl-horizontal">
187<dt>name</dt>
188<dd>the color name (e.g. white, blue, yellow). </dd>
189
190<dd> </dd>
191<dt>compliance</dt>
192<dd>Adhere to this color standard: SVG, X11, or XPM. </dd>
193
194<dd> </dd>
195<dt>color</dt>
196<dd>the red, green, blue, and opacity intensities values of the named color in this structure. </dd>
197
198<dd> </dd>
199<dt>exception</dt>
200<dd>return any errors or warnings in this structure. </dd>
201
202<dd> </dd>
203</dl>
204<h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="QueryColorDatabase">QueryColorDatabase</a></h2>
205
206<p>QueryColorDatabase() returns the red, green, blue, and opacity intensities for a given color name.</p>
207
208<p>The format of the QueryColorDatabase method is:</p>
209
210<pre class="text">
211MagickBooleanType QueryColorDatabase(const char *name,PixelPacket *color,
212 ExceptionInfo *exception)
213</pre>
214
215<p>A description of each parameter follows:</p>
216
217<dd>
218</dd>
219
220<dd> </dd>
221<dl class="dl-horizontal">
222<dt>name</dt>
223<dd>the color name (e.g. white, blue, yellow). </dd>
224
225<dd> </dd>
226<dt>color</dt>
227<dd>the red, green, blue, and opacity intensities values of the named color in this structure. </dd>
228
229<dd> </dd>
230<dt>exception</dt>
231<dd>return any errors or warnings in this structure. </dd>
232
233<dd> </dd>
234</dl>
cristy20398432011-08-11 01:31:50 +0000235<h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="QueryColorname">QueryColorname</a></h2>
cristy20398432011-08-11 01:31:50 +0000236
cristy82a2ff22015-05-12 16:41:32 +0000237<p>QueryColorname() returns a named color for the given color intensity. If an exact match is not found, a rgb() color is returned instead.</p>
cristy20398432011-08-11 01:31:50 +0000238
239<p>The format of the QueryColorname method is:</p>
240
cristy44443b92015-05-05 00:06:07 +0000241<pre class="text">
242MagickBooleanType QueryColorname(const Image *image,
cristy82a2ff22015-05-12 16:41:32 +0000243 const PixelPacket *color,const ComplianceType compliance,char *name,
cristy44443b92015-05-05 00:06:07 +0000244 ExceptionInfo *exception)
cristy20398432011-08-11 01:31:50 +0000245</pre>
246
247<p>A description of each parameter follows.</p>
248
cristy44443b92015-05-05 00:06:07 +0000249<dt>image</dt>
cristy82a2ff22015-05-12 16:41:32 +0000250<p>the image.</p>
251
252<dt>color</dt>
253<p>the color intensities.</p>
254
255<dt>compliance</dt>
256<p>Adhere to this color standard: SVG, X11, or XPM.</p>
257
258<dt>name</dt>
259<p>Return the color name or hex value.</p>
260
261<dt>exception</dt>
262<p>return any errors or warnings in this structure.</p>
263
264<h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="QueryMagickColorCompliance">QueryMagickColorCompliance</a></h2>
265
266<p>QueryMagickColorCompliance() returns the red, green, blue, and opacity intensities for a given color name and standards compliance.</p>
267
268<p>The format of the QueryMagickColor method is:</p>
269
270<pre class="text">
271MagickBooleanType QueryMagickColorCompilence(const char *name,
272 const ComplianceType compliance,MagickPixelPacket *color,
273 ExceptionInfo *exception)
274</pre>
275
276<p>A description of each parameter follows:</p>
277
278<dd>
279</dd>
280
281<dd> </dd>
282<dl class="dl-horizontal">
283<dt>name</dt>
284<dd>the color name (e.g. white, blue, yellow). </dd>
285
286<dd> </dd>
287<dt>compliance</dt>
288<dd>Adhere to this color standard: SVG, X11, or XPM. </dd>
289
290<dd> </dd>
291<dt>color</dt>
292<dd>the red, green, blue, and opacity intensities values of the named color in this structure. </dd>
293
294<dd> </dd>
295<dt>exception</dt>
296<dd>return any errors or warnings in this structure. </dd>
297
298<dd> </dd>
299</dl>
300<h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="QueryMagickColor">QueryMagickColor</a></h2>
301
302<p>QueryMagickColor() returns the red, green, blue, and opacity intensities for a given color name.</p>
303
304<p>The format of the QueryMagickColor method is:</p>
305
306<pre class="text">
307MagickBooleanType QueryMagickColor(const char *name,
308 MagickPixelPacket *color,ExceptionInfo *exception)
309</pre>
310
311<p>A description of each parameter follows:</p>
312
313<dd>
314</dd>
315
316<dd> </dd>
317<dl class="dl-horizontal">
318<dt>name</dt>
319<dd>the color name (e.g. white, blue, yellow). </dd>
320
321<dd> </dd>
322<dt>color</dt>
323<dd>the red, green, blue, and opacity intensities values of the named color in this structure. </dd>
324
325<dd> </dd>
326<dt>exception</dt>
327<dd>return any errors or warnings in this structure. </dd>
328
329<dd> </dd>
330</dl>
331<h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="QueryMagickColorname">QueryMagickColorname</a></h2>
332
333<p>QueryMagickColorname() returns a named color for the given color intensity. If an exact match is not found, a hex value is returned instead. For example an intensity of rgb:(0,0,0) returns black whereas rgb:(223,223,223) returns #dfdfdf.</p>
334
335<p>The format of the QueryMagickColorname method is:</p>
336
337<pre class="text">
338MagickBooleanType QueryMagickColorname(const Image *image,
339 const PixelPacket *color,const ComplianceType compliance,char *name,
340 ExceptionInfo *exception)
341</pre>
342
343<p>A description of each parameter follows.</p>
344
345<dt>image</dt>
346<p>the image.</p>
cristy20398432011-08-11 01:31:50 +0000347
cristy44443b92015-05-05 00:06:07 +0000348<dt>color</dt>
cristy20398432011-08-11 01:31:50 +0000349<p>the color intensities.</p>
350
cristy44443b92015-05-05 00:06:07 +0000351<dt>Compliance</dt>
cristy20398432011-08-11 01:31:50 +0000352<p>Adhere to this color standard: SVG, X11, or XPM.</p>
353
cristy44443b92015-05-05 00:06:07 +0000354<dt>name</dt>
cristy20398432011-08-11 01:31:50 +0000355<p>Return the color name or hex value.</p>
356
cristy44443b92015-05-05 00:06:07 +0000357<dt>exception</dt>
cristy20398432011-08-11 01:31:50 +0000358<p>return any errors or warnings in this structure.</p>
359
cristy06f63f22012-10-31 00:50:07 +0000360</div>
cristy44443b92015-05-05 00:06:07 +0000361 <footer class="magick-footer">
cristy82a2ff22015-05-12 16:41:32 +0000362 <div class="magick-nav-item pull-left">
cristy38185362015-05-07 20:09:56 +0000363 <a href="../support.html">Donate</a>
cristy44443b92015-05-05 00:06:07 +0000364 </div>
cristy38185362015-05-07 20:09:56 +0000365 <p><a href="../sitemap.html">Sitemap</a>
366 <a href="../links.html">Related</a>
cristy44443b92015-05-05 00:06:07 +0000367 <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Image Studio</a>
cristyea2793e2015-05-31 16:52:26 +0000368 <a href="http://jqmagick.imagemagick.org/">JqMagick</a>
cristy44443b92015-05-05 00:06:07 +0000369</p>
370 <p><a href="color.html#">Back to top</a>
cristyea2793e2015-05-31 16:52:26 +0000371 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a>
cristyabed55c2015-05-06 17:07:00 +0000372 <a href="http://www.imagemagick.org/script/contact.php">Contact Us</a></p>
cristya1890f02015-05-15 23:32:44 +0000373 <p><small>© 1999-2015 ImageMagick Studio LLC</small></p>
cristy44443b92015-05-05 00:06:07 +0000374 </footer>
375</div><!-- /.container -->
cristy06f63f22012-10-31 00:50:07 +0000376
cristy44443b92015-05-05 00:06:07 +0000377 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
cristy2f563d42015-05-06 23:36:51 +0000378 <script src="../js/bootstrap.min.js"></script>
cristy44443b92015-05-05 00:06:07 +0000379 <script type="text/javascript">
cristy82a2ff22015-05-12 16:41:32 +0000380 /* <![CDATA[ */
cristy44443b92015-05-05 00:06:07 +0000381 (function() {
382 var s = document.createElement('offline-script'), t = document.getElementsByTagName('offline-script')[0];
383 s.type = 'text/javascript';
384 s.async = true;
385 s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
386 t.parentNode.insertBefore(s, t);
387 })();
cristy82a2ff22015-05-12 16:41:32 +0000388 /* ]]> */
cristy44443b92015-05-05 00:06:07 +0000389 </script>
cristy44cbd482013-08-04 20:53:36 +0000390</div>
cristy06f63f22012-10-31 00:50:07 +0000391</body>
cristy5a367e42015-05-05 12:39:18 +0000392</html>