Home | History | Annotate | Download | only in api
      1 
      2 
      3 
      4 
      5 <!DOCTYPE html>
      6 <html lang="en">
      7 <head>
      8   <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
      9     <title>ImageMagick: MagickCore, C API for ImageMagick: Image Histograms</title>
     10   <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
     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 Bzier 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:, image, histograms, 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-2016 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="../image/wand.png"/>
     26   <link rel="shortcut icon" href="../image/wand.ico"/>
     27   <link rel="stylesheet" href="../css/magick.php"/>
     28 </head>
     29 <body>
     30 <div class="main">
     31 <div class="magick-masthead">
     32   <div class="container">
     33     <script async="async" src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>    <ins class="adsbygoogle"
     34          style="display:block"
     35          data-ad-client="ca-pub-3129977114552745"
     36          data-ad-slot="6345125851"
     37          data-ad-format="auto"></ins>
     38     <script>
     39       (adsbygoogle = window.adsbygoogle || []).push({});
     40     </script>
     41     <nav class="magick-nav">
     42       <a class="magick-nav-item " href="../index.php">Home</a>
     43       <a class="magick-nav-item " href="../script/binary-releases.php">Download</a>
     44       <a class="magick-nav-item " href="../script/command-line-tools.php">Tools</a>
     45       <a class="magick-nav-item " href="../script/command-line-options.php">Options</a>
     46       <a class="magick-nav-item " href="../script/resources.php">Resources</a>
     47       <a class="magick-nav-item " href="../script/api.php">Develop</a>
     48       <a class="magick-nav-item " href="../script/search.php">Search</a>
     49       <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a>
     50     </nav>
     51   </div>
     52 </div>
     53 <div class="container">
     54 <div class="magick-header">
     55 <p class="text-center"><a href="histogram.php#GetImageHistogram">GetImageHistogram</a> &bull; <a href="histogram.php#IdentifyPaletteImage">IdentifyPaletteImage</a> &bull; <a href="histogram.php#IsHistogramImage">IsHistogramImage</a> &bull; <a href="histogram.php#IsPaletteImage">IsPaletteImage</a> &bull; <a href="histogram.php#MinMaxStretchImage">MinMaxStretchImage</a> &bull; <a href="histogram.php#GetNumberColors">GetNumberColors</a> &bull; <a href="histogram.php#UniqueImageColors">UniqueImageColors</a></p>
     56 
     57 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/histogram_8c.html" id="GetImageHistogram">GetImageHistogram</a></h2>
     58 
     59 <p>GetImageHistogram() returns the unique colors in an image.</p>
     60 
     61 <p>The format of the GetImageHistogram method is:</p>
     62 
     63 <pre class="text">
     64 size_t GetImageHistogram(const Image *image,
     65   size_t *number_colors,ExceptionInfo *exception)
     66 </pre>
     67 
     68 <p>A description of each parameter follows.</p>
     69 
     70 <dt>image</dt>
     71 <p>the image.</p>
     72 
     73 <dt>file</dt>
     74 <p>Write a histogram of the color distribution to this file handle.</p>
     75 
     76 <dt>exception</dt>
     77 <p>return any errors or warnings in this structure.</p>
     78 
     79 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/histogram_8c.html" id="IdentifyPaletteImage">IdentifyPaletteImage</a></h2>
     80 
     81 <p>IdentifyPaletteImage() returns MagickTrue if the image has 256 unique colors or less.</p>
     82 
     83 <p>The format of the IdentifyPaletteImage method is:</p>
     84 
     85 <pre class="text">
     86 MagickBooleanType IdentifyPaletteImage(const Image *image,
     87   ExceptionInfo *exception)
     88 </pre>
     89 
     90 <p>A description of each parameter follows.</p>
     91 
     92 <dt>image</dt>
     93 <p>the image.</p>
     94 
     95 <dt>exception</dt>
     96 <p>return any errors or warnings in this structure.</p>
     97 
     98 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/histogram_8c.html" id="IsHistogramImage">IsHistogramImage</a></h2>
     99 
    100 <p>IsHistogramImage() returns MagickTrue if the image has 1024 unique colors or less.</p>
    101 
    102 <p>The format of the IsHistogramImage method is:</p>
    103 
    104 <pre class="text">
    105 MagickBooleanType IsHistogramImage(const Image *image,
    106   ExceptionInfo *exception)
    107 </pre>
    108 
    109 <p>A description of each parameter follows.</p>
    110 
    111 <dt>image</dt>
    112 <p>the image.</p>
    113 
    114 <dt>exception</dt>
    115 <p>return any errors or warnings in this structure.</p>
    116 
    117 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/histogram_8c.html" id="IsPaletteImage">IsPaletteImage</a></h2>
    118 
    119 <p>IsPaletteImage() returns MagickTrue if the image is PseudoClass and has 256 unique colors or less.</p>
    120 
    121 <p>The format of the IsPaletteImage method is:</p>
    122 
    123 <pre class="text">
    124 MagickBooleanType IsPaletteImage(const Image *image)
    125 </pre>
    126 
    127 <p>A description of each parameter follows.</p>
    128 
    129 <dt>image</dt>
    130 <p>the image.</p>
    131 
    132 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/histogram_8c.html" id="MinMaxStretchImage">MinMaxStretchImage</a></h2>
    133 
    134 <p>MinMaxStretchImage() uses the exact minimum and maximum values found in each of the channels given, as the BlackPoint and WhitePoint to linearly stretch the colors (and histogram) of the image.  The stretch points are also moved further inward by the adjustment values given.</p>
    135 
    136 <p>If the adjustment values are both zero this function is equivalent to a perfect normalization (or autolevel) of the image.</p>
    137 
    138 <p>Each channel is stretched independantally of each other (producing color distortion) unless the special 'SyncChannels' flag is also provided in the channels setting. If this flag is present the minimum and maximum point will be extracted from all the given channels, and those channels will be stretched by exactly the same amount (preventing color distortion).</p>
    139 
    140 <p>In the special case that only ONE value is found in a channel of the image that value is not stretched, that value is left as is.</p>
    141 
    142 <p>The 'SyncChannels' is turned on in the 'DefaultChannels' setting by default.</p>
    143 
    144 <p>The format of the MinMaxStretchImage method is:</p>
    145 
    146 <pre class="text">
    147 MagickBooleanType MinMaxStretchImage(Image *image,const double black,
    148   const double white,const double gamma,ExceptionInfo *exception)
    149 </pre>
    150 
    151 <p>A description of each parameter follows:</p>
    152 
    153 <dd>
    154 </dd>
    155 
    156 <dd> </dd>
    157 <dl class="dl-horizontal">
    158 <dt>image</dt>
    159 <dd>The image to auto-level </dd>
    160 
    161 <dd> </dd>
    162 <dt>black, white</dt>
    163 <dd> move the black / white point inward from the minimum and maximum points by this color value. </dd>
    164 
    165 <dd> </dd>
    166 <dt>gamma</dt>
    167 <dd>the gamma. </dd>
    168 
    169 <dd> </dd>
    170 <dt>exception</dt>
    171 <dd>return any errors or warnings in this structure. </dd>
    172 
    173 <dd>  </dd>
    174 </dl>
    175 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/histogram_8c.html" id="GetNumberColors">GetNumberColors</a></h2>
    176 
    177 <p>GetNumberColors() returns the number of unique colors in an image.</p>
    178 
    179 <p>The format of the GetNumberColors method is:</p>
    180 
    181 <pre class="text">
    182 size_t GetNumberColors(const Image *image,FILE *file,
    183   ExceptionInfo *exception)
    184 </pre>
    185 
    186 <p>A description of each parameter follows.</p>
    187 
    188 <dt>image</dt>
    189 <p>the image.</p>
    190 
    191 <dt>file</dt>
    192 <p>Write a histogram of the color distribution to this file handle.</p>
    193 
    194 <dt>exception</dt>
    195 <p>return any errors or warnings in this structure.</p>
    196 
    197 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/histogram_8c.html" id="UniqueImageColors">UniqueImageColors</a></h2>
    198 
    199 <p>UniqueImageColors() returns the unique colors of an image.</p>
    200 
    201 <p>The format of the UniqueImageColors method is:</p>
    202 
    203 <pre class="text">
    204 Image *UniqueImageColors(const Image *image,ExceptionInfo *exception)
    205 </pre>
    206 
    207 <p>A description of each parameter follows.</p>
    208 
    209 <dt>image</dt>
    210 <p>the image.</p>
    211 
    212 <dt>exception</dt>
    213 <p>return any errors or warnings in this structure.</p>
    214 
    215 </div>
    216   <footer class="magick-footer">
    217     <p><a href="../script/support.php">Donate</a> 
    218      <a href="../script/sitemap.php">Sitemap</a> 
    219     <a href="../script/links.php">Related</a> 
    220     <a href="../script/architecture.php">Architecture</a>
    221 </p>
    222     <p><a href="histogram.php#">Back to top</a> 
    223     <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> 
    224     <a href="../script/contact.php">Contact Us</a></p>
    225         <p><small>  1999-2016 ImageMagick Studio LLC</small></p>
    226   </footer>
    227 </div><!-- /.container -->
    228 
    229   <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    230   <script src="http://nextgen.imagemagick.org/js/magick.php"></script>
    231 </div>
    232 </body>
    233 </html>
    234