blob: c3fe16f49ac4f4dc6519643318446351f9d49ec4 [file] [log] [blame]
cristy44443b92015-05-05 00:06:07 +00001<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2<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">
22 <meta name="copyright" content="Copyright (c) 1999-2012 ImageMagick Studio LLC">
23 <meta name="distribution" content="Global">
24 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1">
25 <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">
46 <a class="magick-nav-item " href="../../index.html">Home</a>
47 <a class="magick-nav-item " href="../../www/binary-releases.html">Downloads</a>
48 <a class="magick-nav-item " href="../../www/command-line-tools.html">Tools</a>
49 <a class="magick-nav-item " href="../../www/command-line-options.html">Options</a>
50 <a class="magick-nav-item " href="../../www/api.html">Development</a>
51 <a class="magick-nav-item" href="http://www.imagemagick.org/discourse-server/">Community</a>
52 <a class="magick-nav-item navbar-right " href="http://www.imagemagick.org/script/search.php">Search</a>
53 </nav>
54 </div>
55</div>
56<div class="container">
57<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#QueryColorname">QueryColorname</a></p>
cristy06f63f22012-10-31 00:50:07 +000058
cristy44443b92015-05-05 00:06:07 +000059<div class="magick-header">
60<h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="AcquireColorCache">AcquireColorCache</a></h2>
cristy6f77f692011-02-15 15:31:39 +000061
cristy44443b92015-05-05 00:06:07 +000062<p>AcquireColorCache() caches one or more color configurations which provides a mapping between color attributes and a color name.</p>
63
64<p>The format of the AcquireColorCache method is:</p>
65
66<pre class="text">
67LinkedListInfo *AcquireColorCache(const char *filename,
68 ExceptionInfo *exception)
69</pre>
70
71<p>A description of each parameter follows:</p>
72
73<dd>
74</dd>
75
76<dd> </dd>
77<dl class="dl-horizontal">
78<dt>filename</dt>
79<dd>the font file name. </dd>
80
81<dd> </dd>
82<dt>exception</dt>
83<dd>return any errors or warnings in this structure. </dd>
84
85<dd> </dd>
86</dl>
cristy20398432011-08-11 01:31:50 +000087<h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="GetColorInfoList">GetColorInfoList</a></h2>
cristy20398432011-08-11 01:31:50 +000088
89<p>GetColorInfoList() returns any colors that match the specified pattern.</p>
90
91<p>The format of the GetColorInfoList function is:</p>
92
93<pre class="text">
cristy44443b92015-05-05 00:06:07 +000094const ColorInfo **GetColorInfoList(const char *pattern,
95 size_t *number_colors,ExceptionInfo *exception)
cristy20398432011-08-11 01:31:50 +000096</pre>
97
98<p>A description of each parameter follows:</p>
99
cristy44443b92015-05-05 00:06:07 +0000100<dd>
101</dd>
cristy20398432011-08-11 01:31:50 +0000102
cristy44443b92015-05-05 00:06:07 +0000103<dd> </dd>
104<dl class="dl-horizontal">
105<dt>pattern</dt>
106<dd>Specifies a pointer to a text string containing a pattern. </dd>
cristy20398432011-08-11 01:31:50 +0000107
cristy44443b92015-05-05 00:06:07 +0000108<dd> </dd>
109<dt>number_colors</dt>
110<dd> This integer returns the number of colors in the list. </dd>
cristy20398432011-08-11 01:31:50 +0000111
cristy44443b92015-05-05 00:06:07 +0000112<dd> </dd>
113<dt>exception</dt>
114<dd>return any errors or warnings in this structure. </dd>
115
116<dd> </dd>
117</dl>
cristy20398432011-08-11 01:31:50 +0000118<h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="GetColorList">GetColorList</a></h2>
cristy20398432011-08-11 01:31:50 +0000119
120<p>GetColorList() returns any colors that match the specified pattern.</p>
121
122<p>The format of the GetColorList function is:</p>
123
124<pre class="text">
cristy44443b92015-05-05 00:06:07 +0000125char **GetColorList(const char *pattern,size_t *number_colors,
126 ExceptionInfo *exception)
cristy20398432011-08-11 01:31:50 +0000127</pre>
128
129<p>A description of each parameter follows:</p>
130
cristy44443b92015-05-05 00:06:07 +0000131<dd>
132</dd>
cristy20398432011-08-11 01:31:50 +0000133
cristy44443b92015-05-05 00:06:07 +0000134<dd> </dd>
135<dl class="dl-horizontal">
136<dt>pattern</dt>
137<dd>Specifies a pointer to a text string containing a pattern. </dd>
cristy20398432011-08-11 01:31:50 +0000138
cristy44443b92015-05-05 00:06:07 +0000139<dd> </dd>
140<dt>number_colors</dt>
141<dd> This integer returns the number of colors in the list. </dd>
cristy20398432011-08-11 01:31:50 +0000142
cristy44443b92015-05-05 00:06:07 +0000143<dd> </dd>
144<dt>exception</dt>
145<dd>return any errors or warnings in this structure. </dd>
146
147<dd> </dd>
148</dl>
cristy20398432011-08-11 01:31:50 +0000149<h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="ListColorInfo">ListColorInfo</a></h2>
cristy20398432011-08-11 01:31:50 +0000150
151<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>
152
153<p>The format of the ListColorInfo method is:</p>
154
cristy44443b92015-05-05 00:06:07 +0000155<pre class="text">
156MagickBooleanType ListColorInfo(FILE *file,ExceptionInfo *exception)
cristy20398432011-08-11 01:31:50 +0000157</pre>
158
159<p>A description of each parameter follows.</p>
160
cristy44443b92015-05-05 00:06:07 +0000161<dt>file</dt>
cristy20398432011-08-11 01:31:50 +0000162<p>List color names to this file handle.</p>
163
cristy44443b92015-05-05 00:06:07 +0000164<dt>exception</dt>
cristy20398432011-08-11 01:31:50 +0000165<p>return any errors or warnings in this structure.</p>
166
cristy20398432011-08-11 01:31:50 +0000167<h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="QueryColorname">QueryColorname</a></h2>
cristy20398432011-08-11 01:31:50 +0000168
cristy44443b92015-05-05 00:06:07 +0000169<p>QueryColorname() 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>
170
171<p>UPDATE: the 'image' argument is no longer needed as all information should have been preset using GetPixelInfo().</p>
cristy20398432011-08-11 01:31:50 +0000172
173<p>The format of the QueryColorname method is:</p>
174
cristy44443b92015-05-05 00:06:07 +0000175<pre class="text">
176MagickBooleanType QueryColorname(const Image *image,
177 const PixelInfo *color,const ComplianceType compliance,char *name,
178 ExceptionInfo *exception)
cristy20398432011-08-11 01:31:50 +0000179</pre>
180
181<p>A description of each parameter follows.</p>
182
cristy44443b92015-05-05 00:06:07 +0000183<dt>image</dt>
184<p>the image. (not used! - color gets settings from GetPixelInfo()</p>
cristy20398432011-08-11 01:31:50 +0000185
cristy44443b92015-05-05 00:06:07 +0000186<dt>color</dt>
cristy20398432011-08-11 01:31:50 +0000187<p>the color intensities.</p>
188
cristy44443b92015-05-05 00:06:07 +0000189<dt>Compliance</dt>
cristy20398432011-08-11 01:31:50 +0000190<p>Adhere to this color standard: SVG, X11, or XPM.</p>
191
cristy44443b92015-05-05 00:06:07 +0000192<dt>name</dt>
cristy20398432011-08-11 01:31:50 +0000193<p>Return the color name or hex value.</p>
194
cristy44443b92015-05-05 00:06:07 +0000195<dt>exception</dt>
cristy20398432011-08-11 01:31:50 +0000196<p>return any errors or warnings in this structure.</p>
197
cristy06f63f22012-10-31 00:50:07 +0000198</div>
cristy44443b92015-05-05 00:06:07 +0000199 <footer class="magick-footer">
200 <div class="magick-nav-item navbar-left">
201 <a href="../../www/support.html">Donations</a>
202 </div>
203 <div class="magick-nav-item navbar-right">
204 <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="../../index.html"></a>
205 <noscript>
206 <a href="http://flattr.com/thing/947300/Convert-Edit-And-Compose-Images" target="_blank">
207 <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0"></a>
208 </noscript>
209 </div>
210 <p><a href="../../www/sitemap.html">Sitemap</a>
211 <a href="../../www/links.html">Related</a>
212 <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Image Studio</a>
213 <a href="http://jqmagick.imagemagick.org/">JqMagick</a>
214 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a>
215</p>
216 <p><a href="color.html#">Back to top</a>
217 <a href="../../www/contact.html">Contact Us</a></p>
218 </footer>
219</div><!-- /.container -->
cristy06f63f22012-10-31 00:50:07 +0000220
cristy44443b92015-05-05 00:06:07 +0000221 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
222 <script src="../../js/bootstrap.min.js"></script>
223 <script type="text/javascript">
224 /* */
225 (function() {
226 var s = document.createElement('offline-script'), t = document.getElementsByTagName('offline-script')[0];
227 s.type = 'text/javascript';
228 s.async = true;
229 s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
230 t.parentNode.insertBefore(s, t);
231 })();
232 /* */
233 </script>
cristy44cbd482013-08-04 20:53:36 +0000234</div>
cristy06f63f22012-10-31 00:50:07 +0000235</body>
cristy44443b92015-05-05 00:06:07 +0000236</html><!-- Magick Cache 4th May 2015 18:57 -->