blob: 9c7881a14ff39c2de5a8c2893f2e99295140e5b0 [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>
cristy29f2c972015-07-28 13:37:46 +00004 <title>ImageMagick: MagickCore, C API for ImageMagick: Count the Colors in an Image</title>
cristy44443b92015-05-05 00:06:07 +00005 <meta http-equiv="content-type" content="text/html; charset=utf-8">
cristy44443b92015-05-05 00:06:07 +00006 <meta name="application-name" content="ImageMagick">
7 <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.">
8 <meta name="application-url" content="http://www.imagemagick.org">
9 <meta name="generator" content="PHP">
10 <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">
11 <meta name="rating" content="GENERAL">
12 <meta name="robots" content="INDEX, FOLLOW">
13 <meta name="generator" content="ImageMagick Studio LLC">
14 <meta name="author" content="ImageMagick Studio LLC">
15 <meta name="revisit-after" content="2 DAYS">
16 <meta name="resource-type" content="document">
cristy4e638cd2015-05-07 16:47:40 +000017 <meta name="copyright" content="Copyright (c) 1999-2015 ImageMagick Studio LLC">
cristy44443b92015-05-05 00:06:07 +000018 <meta name="distribution" content="Global">
19 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1">
cristy29f2c972015-07-28 13:37:46 +000020 <link href="../images/wand.png" rel="icon">
21 <link href="../images/wand.ico" type="images/x-icon" rel="shortcut icon">
22 <link href="../css/magick.html" rel="stylesheet">
cristy06f63f22012-10-31 00:50:07 +000023</head>
cristy44443b92015-05-05 00:06:07 +000024<body>
cristy06f63f22012-10-31 00:50:07 +000025<div class="main">
cristy44443b92015-05-05 00:06:07 +000026<div class="magick-masthead">
27 <div class="container">
cristy29f2c972015-07-28 13:37:46 +000028 <script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
29 <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3129977114552745" data-ad-slot="6345125851" data-ad-format="auto"></ins>
30 <script>
31 (adsbygoogle = window.adsbygoogle || []).push({});
cristy44443b92015-05-05 00:06:07 +000032 </script>
cristy44443b92015-05-05 00:06:07 +000033 <nav class="magick-nav">
cristy2f563d42015-05-06 23:36:51 +000034 <a class="magick-nav-item " href="../index.html">Home</a>
cristyea2793e2015-05-31 16:52:26 +000035 <a class="magick-nav-item " href="../binary-releases.html">Download</a>
cristy38185362015-05-07 20:09:56 +000036 <a class="magick-nav-item " href="../command-line-tools.html">Tools</a>
37 <a class="magick-nav-item " href="../command-line-options.html">Options</a>
cristyea2793e2015-05-31 16:52:26 +000038 <a class="magick-nav-item " href="../resources.html">Resources</a>
39 <a class="magick-nav-item " href="api.html">Develop</a>
cristy5b8fe762015-06-09 16:24:03 +000040 <a class="magick-nav-item " href="http://nextgen.imagemagick.org/script/search.php">Search</a>
cristya1890f02015-05-15 23:32:44 +000041 <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a>
cristy44443b92015-05-05 00:06:07 +000042 </nav>
43 </div>
44</div>
45<div class="container">
cristy4e638cd2015-05-07 16:47:40 +000046<div class="magick-header">
cristycecc9492015-06-09 16:53:50 +000047<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>
48
49<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/color_8c.html" id="AcquireColorCache">AcquireColorCache</a></h2>
50
51<p>AcquireColorCache() caches one or more color configurations which provides a mapping between color attributes and a color name.</p>
52
53<p>The format of the AcquireColorCache method is:</p>
54
55<pre class="text">
56LinkedListInfo *AcquireColorCache(const char *filename,
57 ExceptionInfo *exception)
58</pre>
59
60<p>A description of each parameter follows:</p>
61
62<dd>
63</dd>
64
65<dd> </dd>
66<dl class="dl-horizontal">
67<dt>filename</dt>
68<dd>the font file name. </dd>
69
70<dd> </dd>
71<dt>exception</dt>
72<dd>return any errors or warnings in this structure. </dd>
73
74<dd> </dd>
75</dl>
76<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/color_8c.html" id="GetColorInfoList">GetColorInfoList</a></h2>
77
78<p>GetColorInfoList() returns any colors that match the specified pattern.</p>
79
80<p>The format of the GetColorInfoList function is:</p>
81
82<pre class="text">
83const ColorInfo **GetColorInfoList(const char *pattern,
84 size_t *number_colors,ExceptionInfo *exception)
85</pre>
86
87<p>A description of each parameter follows:</p>
88
89<dd>
90</dd>
91
92<dd> </dd>
93<dl class="dl-horizontal">
94<dt>pattern</dt>
95<dd>Specifies a pointer to a text string containing a pattern. </dd>
96
97<dd> </dd>
98<dt>number_colors</dt>
99<dd> This integer returns the number of colors in the list. </dd>
100
101<dd> </dd>
102<dt>exception</dt>
103<dd>return any errors or warnings in this structure. </dd>
104
105<dd> </dd>
106</dl>
107<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/color_8c.html" id="GetColorList">GetColorList</a></h2>
108
109<p>GetColorList() returns any colors that match the specified pattern.</p>
110
111<p>The format of the GetColorList function is:</p>
112
113<pre class="text">
114char **GetColorList(const char *pattern,size_t *number_colors,
115 ExceptionInfo *exception)
116</pre>
117
118<p>A description of each parameter follows:</p>
119
120<dd>
121</dd>
122
123<dd> </dd>
124<dl class="dl-horizontal">
125<dt>pattern</dt>
126<dd>Specifies a pointer to a text string containing a pattern. </dd>
127
128<dd> </dd>
129<dt>number_colors</dt>
130<dd> This integer returns the number of colors in the list. </dd>
131
132<dd> </dd>
133<dt>exception</dt>
134<dd>return any errors or warnings in this structure. </dd>
135
136<dd> </dd>
137</dl>
138<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/color_8c.html" id="ListColorInfo">ListColorInfo</a></h2>
139
140<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>
141
142<p>The format of the ListColorInfo method is:</p>
143
144<pre class="text">
145MagickBooleanType ListColorInfo(FILE *file,ExceptionInfo *exception)
146</pre>
147
148<p>A description of each parameter follows.</p>
149
150<dt>file</dt>
151<p>List color names to this file handle.</p>
152
153<dt>exception</dt>
154<p>return any errors or warnings in this structure.</p>
155
156<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/color_8c.html" id="QueryColorname">QueryColorname</a></h2>
157
158<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>
159
160<p>UPDATE: the 'image' argument is no longer needed as all information should have been preset using GetPixelInfo().</p>
161
162<p>The format of the QueryColorname method is:</p>
163
164<pre class="text">
165MagickBooleanType QueryColorname(const Image *image,
166 const PixelInfo *color,const ComplianceType compliance,char *name,
167 ExceptionInfo *exception)
168</pre>
169
170<p>A description of each parameter follows.</p>
171
172<dt>image</dt>
173<p>the image. (not used! - color gets settings from GetPixelInfo()</p>
174
175<dt>color</dt>
176<p>the color intensities.</p>
177
178<dt>Compliance</dt>
179<p>Adhere to this color standard: SVG, X11, or XPM.</p>
180
181<dt>name</dt>
182<p>Return the color name or hex value.</p>
183
184<dt>exception</dt>
185<p>return any errors or warnings in this structure.</p>
cristy20398432011-08-11 01:31:50 +0000186
cristy06f63f22012-10-31 00:50:07 +0000187</div>
cristy44443b92015-05-05 00:06:07 +0000188 <footer class="magick-footer">
cristy29f2c972015-07-28 13:37:46 +0000189 <p><a href="../support.html">Donate</a>
190 <a href="../sitemap.html">Sitemap</a>
cristy38185362015-05-07 20:09:56 +0000191 <a href="../links.html">Related</a>
cristy29f2c972015-07-28 13:37:46 +0000192 <a href="../architecture.html">Architecture</a>
cristy44443b92015-05-05 00:06:07 +0000193</p>
194 <p><a href="color.html#">Back to top</a>
cristyea2793e2015-05-31 16:52:26 +0000195 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a>
cristy5b8fe762015-06-09 16:24:03 +0000196 <a href="http://nextgen.imagemagick.org/script/contact.php">Contact Us</a></p>
cristya1890f02015-05-15 23:32:44 +0000197 <p><small>© 1999-2015 ImageMagick Studio LLC</small></p>
cristy44443b92015-05-05 00:06:07 +0000198 </footer>
199</div><!-- /.container -->
cristy06f63f22012-10-31 00:50:07 +0000200
cristy44443b92015-05-05 00:06:07 +0000201 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
cristy29f2c972015-07-28 13:37:46 +0000202 <script src="http://nextgen.imagemagick.org/js/magick.html"></script>
cristy44cbd482013-08-04 20:53:36 +0000203</div>
cristy06f63f22012-10-31 00:50:07 +0000204</body>
cristy5a367e42015-05-05 12:39:18 +0000205</html>