• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2
3
4
5<!DOCTYPE html>
6<html lang="en">
7<head>
8  <meta charset="utf-8"  />
9  <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,shrink-to-fit=no"  />
10  <title>ImageMagick - MagickCore, C API: Count the Colors in an Image</title>
11  <meta name="application-name" content="ImageMagick" />
12  <meta name="description" content="Use ImageMagick® to create, edit, compose, and convert bitmap images. Resize an image, crop it, change its shades and colors, add captions, and more." />
13  <meta name="application-url" content="https://imagemagick.org" />
14  <meta name="generator" content="PHP" />
15  <meta name="keywords" content="magickcore, c, api:, 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-2020 ImageMagick Studio LLC" />
23  <meta name="distribution" content="Global" />
24  <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1" />
25  <meta property='og:url' content='../../' />
26  <meta property='og:title' content='ImageMagick' />
27  <meta property='og:image' content='../../images/logo.png' />
28  <meta property='og:type' content='website' />
29  <meta property='og:site_name' content='ImageMagick' />
30  <meta property='og:description' content="Convert, Edit, or Compose Bitmap Images" />
31  <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
32  <link href="color.html" rel="canonical" />
33  <link href="../../images/wand.png" rel="icon" />
34  <link href="../../images/wand.ico" rel="shortcut icon" />
35  <link href="../assets/magick.css" rel="stylesheet" />
36</head>
37<body>
38  <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
39    <a class="navbar-brand" href="../../"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="../../images/wand.ico"/></a>
40    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsMagick" aria-controls="navbarsMagick" aria-expanded="false" aria-label="Toggle navigation">
41      <span class="navbar-toggler-icon"></span>
42    </button>
43
44    <div class="navbar-collapse collapse" id="navbarsMagick" style="">
45    <ul class="navbar-nav mr-auto">
46      <li class="nav-item ">
47        <a class="nav-link" href="../../">Home <span class="sr-only">(current)</span></a>
48      </li>
49      <li class="nav-item ">
50        <a class="nav-link" href="../../www/download.html">Download</a>
51      </li>
52      <li class="nav-item ">
53        <a class="nav-link" href="../../www/command-line-tools.html">Tools</a>
54      </li>
55      <li class="nav-item ">
56        <a class="nav-link" href="../../www/command-line-processing.html">Command-line</a>
57      </li>
58      <li class="nav-item ">
59        <a class="nav-link" href="../../www/resources.html">Resources</a>
60      </li>
61      <li class="nav-item ">
62        <a class="nav-link" href="../../www/develop.html">Develop</a>
63      </li>
64      <li class="nav-item">
65        <a class="nav-link" target="_blank" href="https://imagemagick.org/discourse-server/">Community</a>
66      </li>
67    </ul>
68    <form class="form-inline my-2 my-lg-0" action="../https://imagemagick.org/script/search.php">
69      <input class="form-control mr-sm-2" type="text" name="q" placeholder="Search" aria-label="Search">
70      <button class="btn btn-outline-success my-2 my-sm-0" type="submit" name="sa">Search</button>
71    </form>
72    </div>
73  </nav>
74  <div class="container">
75   <script async="async" src="https://localhost/pagead/js/adsbygoogle.js"></script>    <ins class="adsbygoogle"
76         style="display:block"
77         data-ad-client="ca-pub-3129977114552745"
78         data-ad-slot="6345125851"
79         data-full-width-responsive="true"
80         data-ad-format="horizontal"></ins>
81    <script>
82      (adsbygoogle = window.adsbygoogle || []).push({});
83    </script>
84
85  </div>
86
87  <main class="container">
88    <div class="magick-template">
89<div class="magick-header">
90<p class="text-center"><a href="color.html#AcquireColorCache">AcquireColorCache</a> &#8226; <a href="color.html#GetColorInfoList">GetColorInfoList</a> &#8226; <a href="color.html#GetColorList">GetColorList</a> &#8226; <a href="color.html#ListColorInfo">ListColorInfo</a> &#8226; <a href="color.html#QueryColorname">QueryColorname</a></p>
91
92<h2><a href="../../api/MagickCore/color_8c.html" id="AcquireColorCache">AcquireColorCache</a></h2>
93
94<p>AcquireColorCache() caches one or more color configurations which provides a mapping between color attributes and a color name.</p>
95
96<p>The format of the AcquireColorCache method is:</p>
97
98<pre class="text">
99LinkedListInfo *AcquireColorCache(const char *filename,
100  ExceptionInfo *exception)
101</pre>
102
103<p>A description of each parameter follows:</p>
104
105<dd>
106</dd>
107
108<dd> </dd>
109<dl class="dl-horizontal">
110<dt>filename</dt>
111<dd>the font file name. </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="../../api/MagickCore/color_8c.html" id="GetColorInfoList">GetColorInfoList</a></h2>
120
121<p>GetColorInfoList() returns any colors that match the specified pattern.</p>
122
123<p>The format of the GetColorInfoList function is:</p>
124
125<pre class="text">
126const ColorInfo **GetColorInfoList(const char *pattern,
127  size_t *number_colors,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="../../api/MagickCore/color_8c.html" id="GetColorList">GetColorList</a></h2>
151
152<p>GetColorList() returns any colors that match the specified pattern.</p>
153
154<p>The format of the GetColorList function is:</p>
155
156<pre class="text">
157char **GetColorList(const char *pattern,size_t *number_colors,
158  ExceptionInfo *exception)
159</pre>
160
161<p>A description of each parameter follows:</p>
162
163<dd>
164</dd>
165
166<dd> </dd>
167<dl class="dl-horizontal">
168<dt>pattern</dt>
169<dd>Specifies a pointer to a text string containing a pattern. </dd>
170
171<dd> </dd>
172<dt>number_colors</dt>
173<dd> This integer returns the number of colors in the list. </dd>
174
175<dd> </dd>
176<dt>exception</dt>
177<dd>return any errors or warnings in this structure. </dd>
178
179<dd>  </dd>
180</dl>
181<h2><a href="../../api/MagickCore/color_8c.html" id="ListColorInfo">ListColorInfo</a></h2>
182
183<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>
184
185<p>The format of the ListColorInfo method is:</p>
186
187<pre class="text">
188MagickBooleanType ListColorInfo(FILE *file,ExceptionInfo *exception)
189</pre>
190
191<p>A description of each parameter follows.</p>
192
193<dt>file</dt>
194<p>List color names to this file handle.</p>
195
196<dt>exception</dt>
197<p>return any errors or warnings in this structure.</p>
198
199<h2><a href="../../api/MagickCore/color_8c.html" id="QueryColorname">QueryColorname</a></h2>
200
201<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>
202
203<p>UPDATE: the 'image' argument is no longer needed as all information should have been preset using GetPixelInfo().</p>
204
205<p>The format of the QueryColorname method is:</p>
206
207<pre class="text">
208MagickBooleanType QueryColorname(const Image *image,
209  const PixelInfo *color,const ComplianceType compliance,char *name,
210  ExceptionInfo *exception)
211</pre>
212
213<p>A description of each parameter follows.</p>
214
215<dt>image</dt>
216<p>the image. (not used! - color gets settings from GetPixelInfo()</p>
217
218<dt>color</dt>
219<p>the color intensities.</p>
220
221<dt>Compliance</dt>
222<p>Adhere to this color standard: SVG, X11, or XPM.</p>
223
224<dt>name</dt>
225<p>Return the color name or hex value.</p>
226
227<dt>exception</dt>
228<p>return any errors or warnings in this structure.</p>
229
230</div>
231    </div>
232  </main><!-- /.container -->
233  <footer class="magick-footer">
234    <p><a href="../../www/security-policy.html">Security</a> •
235    <a href="../../www/architecture.html">Architecture</a>
236
237    <a href="color.html#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../../images/wand.ico"/></a>
238
239    <a href="../../www/links.html">Related</a> •
240     <a href="../../www/sitemap.html">Sitemap</a>
241    <br/>
242    <a href="../../www/support.html">Donate</a> •
243    <a href="http://pgp.mit.edu/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a> •
244    <a href="../../www/contact.html">Contact Us</a>
245    <br/>
246    <small>© 1999-2020 ImageMagick Studio LLC</small></p>
247  </footer>
248
249  <!-- Javascript assets -->
250  <script src="../assets/magick.js" crossorigin="anonymous"></script>
251  <script>window.jQuery || document.write('<script src="https://localhost/ajax/libs/jquery/3.4.1/jquery.min.js"><\/script>')</script>
252</body>
253</html>
254<!-- Magick Cache 4th January 2020 08:23 -->