cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 2 | <html lang="en"> |
cristy | 06f63f2 | 2012-10-31 00:50:07 +0000 | [diff] [blame] | 3 | <head> |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 4 | <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"> |
cristy | ffb69ed | 2010-12-25 00:06:48 +0000 | [diff] [blame] | 7 | <title>ImageMagick: MagickCore, C API for ImageMagick: Count the Colors in an Image</title> |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 8 | <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"> |
cristy | 4e638cd | 2015-05-07 16:47:40 +0000 | [diff] [blame^] | 22 | <meta name="copyright" content="Copyright (c) 1999-2015 ImageMagick Studio LLC"> |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 23 | <meta name="distribution" content="Global"> |
| 24 | <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1"> |
cristy | 2f563d4 | 2015-05-06 23:36:51 +0000 | [diff] [blame] | 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"> |
cristy | 06f63f2 | 2012-10-31 00:50:07 +0000 | [diff] [blame] | 29 | </head> |
| 30 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 31 | <body> |
cristy | 06f63f2 | 2012-10-31 00:50:07 +0000 | [diff] [blame] | 32 | <div class="main"> |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 33 | <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"> |
cristy | 2f563d4 | 2015-05-06 23:36:51 +0000 | [diff] [blame] | 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> |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 51 | <a class="magick-nav-item" href="http://www.imagemagick.org/discourse-server/">Community</a> |
cristy | abed55c | 2015-05-06 17:07:00 +0000 | [diff] [blame] | 52 | <a class="magick-nav-item navbar-right " href="http://www.imagemagick.org/script/search.php">Search</a> |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 53 | </nav> |
| 54 | </div> |
| 55 | </div> |
| 56 | <div class="container"> |
cristy | 4e638cd | 2015-05-07 16:47:40 +0000 | [diff] [blame^] | 57 | <div class="magick-header"> |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 58 | <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> |
cristy | 06f63f2 | 2012-10-31 00:50:07 +0000 | [diff] [blame] | 59 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 60 | <h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="AcquireColorCache">AcquireColorCache</a></h2> |
cristy | 6f77f69 | 2011-02-15 15:31:39 +0000 | [diff] [blame] | 61 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 62 | <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"> |
| 67 | LinkedListInfo *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> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 87 | <h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="GetColorInfoList">GetColorInfoList</a></h2> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 88 | |
| 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"> |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 94 | const ColorInfo **GetColorInfoList(const char *pattern, |
| 95 | size_t *number_colors,ExceptionInfo *exception) |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 96 | </pre> |
| 97 | |
| 98 | <p>A description of each parameter follows:</p> |
| 99 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 100 | <dd> |
| 101 | </dd> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 102 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 103 | <dd> </dd> |
| 104 | <dl class="dl-horizontal"> |
| 105 | <dt>pattern</dt> |
| 106 | <dd>Specifies a pointer to a text string containing a pattern. </dd> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 107 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 108 | <dd> </dd> |
| 109 | <dt>number_colors</dt> |
| 110 | <dd> This integer returns the number of colors in the list. </dd> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 111 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 112 | <dd> </dd> |
| 113 | <dt>exception</dt> |
| 114 | <dd>return any errors or warnings in this structure. </dd> |
| 115 | |
| 116 | <dd> </dd> |
| 117 | </dl> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 118 | <h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="GetColorList">GetColorList</a></h2> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 119 | |
| 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"> |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 125 | char **GetColorList(const char *pattern,size_t *number_colors, |
| 126 | ExceptionInfo *exception) |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 127 | </pre> |
| 128 | |
| 129 | <p>A description of each parameter follows:</p> |
| 130 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 131 | <dd> |
| 132 | </dd> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 133 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 134 | <dd> </dd> |
| 135 | <dl class="dl-horizontal"> |
| 136 | <dt>pattern</dt> |
| 137 | <dd>Specifies a pointer to a text string containing a pattern. </dd> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 138 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 139 | <dd> </dd> |
| 140 | <dt>number_colors</dt> |
| 141 | <dd> This integer returns the number of colors in the list. </dd> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 142 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 143 | <dd> </dd> |
| 144 | <dt>exception</dt> |
| 145 | <dd>return any errors or warnings in this structure. </dd> |
| 146 | |
| 147 | <dd> </dd> |
| 148 | </dl> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 149 | <h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="ListColorInfo">ListColorInfo</a></h2> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 150 | |
| 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 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 155 | <pre class="text"> |
| 156 | MagickBooleanType ListColorInfo(FILE *file,ExceptionInfo *exception) |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 157 | </pre> |
| 158 | |
| 159 | <p>A description of each parameter follows.</p> |
| 160 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 161 | <dt>file</dt> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 162 | <p>List color names to this file handle.</p> |
| 163 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 164 | <dt>exception</dt> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 165 | <p>return any errors or warnings in this structure.</p> |
| 166 | |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 167 | <h2><a href="http://www.imagemagick.org/api/MagickCore/color_8c.html" id="QueryColorname">QueryColorname</a></h2> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 168 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 169 | <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> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 172 | |
| 173 | <p>The format of the QueryColorname method is:</p> |
| 174 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 175 | <pre class="text"> |
| 176 | MagickBooleanType QueryColorname(const Image *image, |
| 177 | const PixelInfo *color,const ComplianceType compliance,char *name, |
| 178 | ExceptionInfo *exception) |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 179 | </pre> |
| 180 | |
| 181 | <p>A description of each parameter follows.</p> |
| 182 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 183 | <dt>image</dt> |
| 184 | <p>the image. (not used! - color gets settings from GetPixelInfo()</p> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 185 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 186 | <dt>color</dt> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 187 | <p>the color intensities.</p> |
| 188 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 189 | <dt>Compliance</dt> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 190 | <p>Adhere to this color standard: SVG, X11, or XPM.</p> |
| 191 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 192 | <dt>name</dt> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 193 | <p>Return the color name or hex value.</p> |
| 194 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 195 | <dt>exception</dt> |
cristy | 2039843 | 2011-08-11 01:31:50 +0000 | [diff] [blame] | 196 | <p>return any errors or warnings in this structure.</p> |
| 197 | |
cristy | 06f63f2 | 2012-10-31 00:50:07 +0000 | [diff] [blame] | 198 | </div> |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 199 | <footer class="magick-footer"> |
| 200 | <div class="magick-nav-item navbar-left"> |
cristy | 2f563d4 | 2015-05-06 23:36:51 +0000 | [diff] [blame] | 201 | <a href="../www/support.html">Donate</a> |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 202 | </div> |
cristy | 2f563d4 | 2015-05-06 23:36:51 +0000 | [diff] [blame] | 203 | <p><a href="../www/sitemap.html">Sitemap</a> • |
| 204 | <a href="../www/links.html">Related</a> • |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 205 | <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Image Studio</a> • |
| 206 | <a href="http://jqmagick.imagemagick.org/">JqMagick</a> • |
| 207 | <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> |
| 208 | </p> |
| 209 | <p><a href="color.html#">Back to top</a> • |
cristy | abed55c | 2015-05-06 17:07:00 +0000 | [diff] [blame] | 210 | <a href="http://www.imagemagick.org/script/contact.php">Contact Us</a></p> |
cristy | 4e638cd | 2015-05-07 16:47:40 +0000 | [diff] [blame^] | 211 | <p class="small">© 1999-2015 ImageMagick Studio LLC</p> |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 212 | </footer> |
| 213 | </div><!-- /.container --> |
cristy | 06f63f2 | 2012-10-31 00:50:07 +0000 | [diff] [blame] | 214 | |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 215 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> |
cristy | 2f563d4 | 2015-05-06 23:36:51 +0000 | [diff] [blame] | 216 | <script src="../js/bootstrap.min.js"></script> |
cristy | 44443b9 | 2015-05-05 00:06:07 +0000 | [diff] [blame] | 217 | <script type="text/javascript"> |
| 218 | /* */ |
| 219 | (function() { |
| 220 | var s = document.createElement('offline-script'), t = document.getElementsByTagName('offline-script')[0]; |
| 221 | s.type = 'text/javascript'; |
| 222 | s.async = true; |
| 223 | s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto'; |
| 224 | t.parentNode.insertBefore(s, t); |
| 225 | })(); |
| 226 | /* */ |
| 227 | </script> |
cristy | 44cbd48 | 2013-08-04 20:53:36 +0000 | [diff] [blame] | 228 | </div> |
cristy | 06f63f2 | 2012-10-31 00:50:07 +0000 | [diff] [blame] | 229 | </body> |
cristy | 5a367e4 | 2015-05-05 12:39:18 +0000 | [diff] [blame] | 230 | </html> |