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: Get or Set Image Channels</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:, get, or, set, image, channels, 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="channel.php#ChannelFxImage">ChannelFxImage</a> &bull; <a href="channel.php#CombineImages">CombineImages</a> &bull; <a href="channel.php#GetImageAlphaChannel">GetImageAlphaChannel</a> &bull; <a href="channel.php#SeparateImage">SeparateImage</a> &bull; <a href="channel.php#SeparateImages">SeparateImages</a> &bull; <a href="channel.php#SetImageAlphaChannel">SetImageAlphaChannel</a></p>
     56 
     57 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/channel_8c.html" id="ChannelFxImage">ChannelFxImage</a></h2>
     58 
     59 <p>ChannelFxImage() applies a channel expression to the specified image.  The expression consists of one or more channels, either mnemonic or numeric (e.g. red, 1), separated by actions as follows:</p>
     60 
     61 <dd>
     62 </dd>
     63 
     64 <dd> &lt;=&gt;     exchange two channels (e.g. red&lt;=&gt;blue) =&gt;      copy one channel to another channel (e.g. red=&gt;green) =       assign a constant value to a channel (e.g. red=50) ,       write new image channels in the specified order (e.g. red, green) |       add a new output image for the next set of channel operations ;       move to the next input image for the source of channel data </dd>
     65 
     66 <dd> For example, to create 3 grayscale images from the red, green, and blue channels of an image, use: </dd>
     67 
     68 <pre class="text">
     69     -channel-fx "red; green; blue"
     70 </pre>
     71 
     72 <p>A channel without an operation symbol implies separate (i.e, semicolon). </dd>
     73 
     74 <dd> The format of the ChannelFxImage method is: </dd>
     75 
     76 <pre class="text">
     77 Image *ChannelFxImage(const Image *image,const char *expression,
     78   ExceptionInfo *exception)
     79 </pre>
     80 
     81 <p>A description of each parameter follows: </dd>
     82 
     83 <dd>
     84 </dd>
     85 
     86 <dd> </dd>
     87 <dl class="dl-horizontal">
     88 <dt>image</dt>
     89 <dd>the image. </dd>
     90 
     91 <dd> </dd>
     92 <dt>expression</dt>
     93 <dd>A channel expression. </dd>
     94 
     95 <dd> </dd>
     96 <dt>exception</dt>
     97 <dd>return any errors or warnings in this structure. </dd>
     98 
     99 <dd>  </dd>
    100 </dl>
    101 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/channel_8c.html" id="CombineImages">CombineImages</a></h2>
    102 
    103 <p>CombineImages() combines one or more images into a single image.  The grayscale value of the pixels of each image in the sequence is assigned in order to the specified channels of the combined image.   The typical ordering would be image 1 =&gt; Red, 2 =&gt; Green, 3 =&gt; Blue, etc.</p>
    104 
    105 <p>The format of the CombineImages method is:</p>
    106 
    107 <pre class="text">
    108 Image *CombineImages(const Image *images,const ColorspaceType colorspace,
    109   ExceptionInfo *exception)
    110 </pre>
    111 
    112 <p>A description of each parameter follows:</p>
    113 
    114 <dd>
    115 </dd>
    116 
    117 <dd> </dd>
    118 <dl class="dl-horizontal">
    119 <dt>images</dt>
    120 <dd>the image sequence. </dd>
    121 
    122 <dd> </dd>
    123 <dt>colorspace</dt>
    124 <dd>the image colorspace. </dd>
    125 
    126 <dd> </dd>
    127 <dt>exception</dt>
    128 <dd>return any errors or warnings in this structure. </dd>
    129 
    130 <dd>  </dd>
    131 </dl>
    132 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/channel_8c.html" id="GetImageAlphaChannel">GetImageAlphaChannel</a></h2>
    133 
    134 <p>GetImageAlphaChannel() returns MagickFalse if the image alpha channel is not activated.  That is, the image is RGB rather than RGBA or CMYK rather than CMYKA.</p>
    135 
    136 <p>The format of the GetImageAlphaChannel method is:</p>
    137 
    138 <pre class="text">
    139 MagickBooleanType GetImageAlphaChannel(const Image *image)
    140 </pre>
    141 
    142 <p>A description of each parameter follows:</p>
    143 
    144 <dd>
    145 </dd>
    146 
    147 <dd> </dd>
    148 <dl class="dl-horizontal">
    149 <dt>image</dt>
    150 <dd>the image. </dd>
    151 
    152 <dd>  </dd>
    153 </dl>
    154 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/channel_8c.html" id="SeparateImage">SeparateImage</a></h2>
    155 
    156 <p>SeparateImage() separates a channel from the image and returns it as a grayscale image.</p>
    157 
    158 <p>The format of the SeparateImage method is:</p>
    159 
    160 <pre class="text">
    161 Image *SeparateImage(const Image *image,const ChannelType channel,
    162   ExceptionInfo *exception)
    163 </pre>
    164 
    165 <p>A description of each parameter follows:</p>
    166 
    167 <dd>
    168 </dd>
    169 
    170 <dd> </dd>
    171 <dl class="dl-horizontal">
    172 <dt>image</dt>
    173 <dd>the image. </dd>
    174 
    175 <dd> </dd>
    176 <dt>channel</dt>
    177 <dd>the image channel. </dd>
    178 
    179 <dd> </dd>
    180 <dt>exception</dt>
    181 <dd>return any errors or warnings in this structure. </dd>
    182 
    183 <dd>  </dd>
    184 </dl>
    185 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/channel_8c.html" id="SeparateImages">SeparateImages</a></h2>
    186 
    187 <p>SeparateImages() returns a separate grayscale image for each channel specified.</p>
    188 
    189 <p>The format of the SeparateImages method is:</p>
    190 
    191 <pre class="text">
    192 Image *SeparateImages(const Image *image,ExceptionInfo *exception)
    193 </pre>
    194 
    195 <p>A description of each parameter follows:</p>
    196 
    197 <dd>
    198 </dd>
    199 
    200 <dd> </dd>
    201 <dl class="dl-horizontal">
    202 <dt>image</dt>
    203 <dd>the image. </dd>
    204 
    205 <dd> </dd>
    206 <dt>exception</dt>
    207 <dd>return any errors or warnings in this structure. </dd>
    208 
    209 <dd>  </dd>
    210 </dl>
    211 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/channel_8c.html" id="SetImageAlphaChannel">SetImageAlphaChannel</a></h2>
    212 
    213 <p>SetImageAlphaChannel() activates, deactivates, resets, or sets the alpha channel.</p>
    214 
    215 <p>The format of the SetImageAlphaChannel method is:</p>
    216 
    217 <pre class="text">
    218 MagickBooleanType SetImageAlphaChannel(Image *image,
    219   const AlphaChannelOption alpha_type,ExceptionInfo *exception)
    220 </pre>
    221 
    222 <p>A description of each parameter follows:</p>
    223 
    224 <dd>
    225 </dd>
    226 
    227 <dd> </dd>
    228 <dl class="dl-horizontal">
    229 <dt>image</dt>
    230 <dd>the image. </dd>
    231 
    232 <dd> </dd>
    233 <dt>alpha_type</dt>
    234 <dd> The alpha channel type: ActivateAlphaChannel, AssociateAlphaChannel, CopyAlphaChannel, DeactivateAlphaChannel, DisassociateAlphaChannel,  ExtractAlphaChannel, OffAlphaChannel, OnAlphaChannel, OpaqueAlphaChannel, SetAlphaChannel, ShapeAlphaChannel, and TransparentAlphaChannel. </dd>
    235 
    236 <dd> </dd>
    237 <dt>exception</dt>
    238 <dd>return any errors or warnings in this structure. </dd>
    239 
    240 <dd>  </dd>
    241 </dl>
    242 </div>
    243   <footer class="magick-footer">
    244     <p><a href="../script/support.php">Donate</a> 
    245      <a href="../script/sitemap.php">Sitemap</a> 
    246     <a href="../script/links.php">Related</a> 
    247     <a href="../script/architecture.php">Architecture</a>
    248 </p>
    249     <p><a href="channel.php#">Back to top</a> 
    250     <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> 
    251     <a href="../script/contact.php">Contact Us</a></p>
    252         <p><small>  1999-2016 ImageMagick Studio LLC</small></p>
    253   </footer>
    254 </div><!-- /.container -->
    255 
    256   <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    257   <script src="http://nextgen.imagemagick.org/js/magick.php"></script>
    258 </div>
    259 </body>
    260 </html>
    261