blob: 978a86c1cbe8b108d5820dff7a9d4e7873f09439 [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>
cristy5b8fe762015-06-09 16:24:03 +000052 <a class="magick-nav-item " href="http://nextgen.imagemagick.org/script/search.php">Search</a>
cristya1890f02015-05-15 23:32:44 +000053 <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">
cristycecc9492015-06-09 16:53:50 +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#QueryColorname">QueryColorname</a></p>
60
61<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/color_8c.html" id="AcquireColorCache">AcquireColorCache</a></h2>
62
63<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>
88<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/color_8c.html" id="GetColorInfoList">GetColorInfoList</a></h2>
89
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">
95const ColorInfo **GetColorInfoList(const char *pattern,
96 size_t *number_colors,ExceptionInfo *exception)
97</pre>
98
99<p>A description of each parameter follows:</p>
100
101<dd>
102</dd>
103
104<dd> </dd>
105<dl class="dl-horizontal">
106<dt>pattern</dt>
107<dd>Specifies a pointer to a text string containing a pattern. </dd>
108
109<dd> </dd>
110<dt>number_colors</dt>
111<dd> This integer returns the number of colors in the list. </dd>
112
113<dd> </dd>
114<dt>exception</dt>
115<dd>return any errors or warnings in this structure. </dd>
116
117<dd> </dd>
118</dl>
119<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/color_8c.html" id="GetColorList">GetColorList</a></h2>
120
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">
126char **GetColorList(const char *pattern,size_t *number_colors,
127 ExceptionInfo *exception)
128</pre>
129
130<p>A description of each parameter follows:</p>
131
132<dd>
133</dd>
134
135<dd> </dd>
136<dl class="dl-horizontal">
137<dt>pattern</dt>
138<dd>Specifies a pointer to a text string containing a pattern. </dd>
139
140<dd> </dd>
141<dt>number_colors</dt>
142<dd> This integer returns the number of colors in the list. </dd>
143
144<dd> </dd>
145<dt>exception</dt>
146<dd>return any errors or warnings in this structure. </dd>
147
148<dd> </dd>
149</dl>
150<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/color_8c.html" id="ListColorInfo">ListColorInfo</a></h2>
151
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
156<pre class="text">
157MagickBooleanType ListColorInfo(FILE *file,ExceptionInfo *exception)
158</pre>
159
160<p>A description of each parameter follows.</p>
161
162<dt>file</dt>
163<p>List color names to this file handle.</p>
164
165<dt>exception</dt>
166<p>return any errors or warnings in this structure.</p>
167
168<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/color_8c.html" id="QueryColorname">QueryColorname</a></h2>
169
170<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>
171
172<p>UPDATE: the 'image' argument is no longer needed as all information should have been preset using GetPixelInfo().</p>
173
174<p>The format of the QueryColorname method is:</p>
175
176<pre class="text">
177MagickBooleanType QueryColorname(const Image *image,
178 const PixelInfo *color,const ComplianceType compliance,char *name,
179 ExceptionInfo *exception)
180</pre>
181
182<p>A description of each parameter follows.</p>
183
184<dt>image</dt>
185<p>the image. (not used! - color gets settings from GetPixelInfo()</p>
186
187<dt>color</dt>
188<p>the color intensities.</p>
189
190<dt>Compliance</dt>
191<p>Adhere to this color standard: SVG, X11, or XPM.</p>
192
193<dt>name</dt>
194<p>Return the color name or hex value.</p>
195
196<dt>exception</dt>
197<p>return any errors or warnings in this structure.</p>
cristy20398432011-08-11 01:31:50 +0000198
cristy06f63f22012-10-31 00:50:07 +0000199</div>
cristy44443b92015-05-05 00:06:07 +0000200 <footer class="magick-footer">
cristy82a2ff22015-05-12 16:41:32 +0000201 <div class="magick-nav-item pull-left">
cristy38185362015-05-07 20:09:56 +0000202 <a href="../support.html">Donate</a>
cristy44443b92015-05-05 00:06:07 +0000203 </div>
cristy38185362015-05-07 20:09:56 +0000204 <p><a href="../sitemap.html">Sitemap</a>
205 <a href="../links.html">Related</a>
cristy44443b92015-05-05 00:06:07 +0000206 <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Image Studio</a>
cristyea2793e2015-05-31 16:52:26 +0000207 <a href="http://jqmagick.imagemagick.org/">JqMagick</a>
cristy44443b92015-05-05 00:06:07 +0000208</p>
209 <p><a href="color.html#">Back to top</a>
cristyea2793e2015-05-31 16:52:26 +0000210 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a>
cristy5b8fe762015-06-09 16:24:03 +0000211 <a href="http://nextgen.imagemagick.org/script/contact.php">Contact Us</a></p>
cristya1890f02015-05-15 23:32:44 +0000212 <p><small>© 1999-2015 ImageMagick Studio LLC</small></p>
cristy44443b92015-05-05 00:06:07 +0000213 </footer>
214</div><!-- /.container -->
cristy06f63f22012-10-31 00:50:07 +0000215
cristy44443b92015-05-05 00:06:07 +0000216 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
cristy2f563d42015-05-06 23:36:51 +0000217 <script src="../js/bootstrap.min.js"></script>
cristy44443b92015-05-05 00:06:07 +0000218 <script type="text/javascript">
cristy82a2ff22015-05-12 16:41:32 +0000219 /* <![CDATA[ */
cristy44443b92015-05-05 00:06:07 +0000220 (function() {
221 var s = document.createElement('offline-script'), t = document.getElementsByTagName('offline-script')[0];
222 s.type = 'text/javascript';
223 s.async = true;
224 s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
225 t.parentNode.insertBefore(s, t);
226 })();
cristy82a2ff22015-05-12 16:41:32 +0000227 /* ]]> */
cristy44443b92015-05-05 00:06:07 +0000228 </script>
cristy44cbd482013-08-04 20:53:36 +0000229</div>
cristy06f63f22012-10-31 00:50:07 +0000230</body>
cristy5a367e42015-05-05 12:39:18 +0000231</html>