1 2 3 4 5<!DOCTYPE html> 6<html lang="en"> 7<head> 8 <title>ImageMagick: MagickCore, C API for ImageMagick: Get or Set Image Channels</title> 9 <meta charset="utf-8" /> 10 <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 11 <meta name="viewport" content="width=device-width, initial-scale=1" /> 12 <meta http-equiv="content-type" content="text/html; charset=utf-8"/> 13 <meta name="application-name" content="ImageMagick"/> 14 <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."/> 15 <meta name="application-url" content="http://www.imagemagick.org"/> 16 <meta name="generator" content="PHP"/> 17 <meta name="keywords" content="magickcore, c, api, for, imagemagick:, get, or, set, image, channels, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert"/> 18 <meta name="rating" content="GENERAL"/> 19 <meta name="robots" content="INDEX, FOLLOW"/> 20 <meta name="generator" content="ImageMagick Studio LLC"/> 21 <meta name="author" content="ImageMagick Studio LLC"/> 22 <meta name="revisit-after" content="2 DAYS"/> 23 <meta name="resource-type" content="document"/> 24 <meta name="copyright" content="Copyright (c) 1999-2016 ImageMagick Studio LLC"/> 25 <meta name="distribution" content="Global"/> 26 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1"/> 27 <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" /> 28 <link rel="icon" href="../images/wand.png"/> 29 <link rel="shortcut icon" href="../images/wand.ico"/> 30 <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:900,400,400italic,700,700italic,300,300italic|Open+Sans:300italic,400italic,700italic,300,400,600,700"> 31 <link rel="stylesheet" href="../css/magick.html"/> 32</head> 33<body> 34<div class="main"> 35<div class="magick-masthead"> 36 <div class="container"> 37 <script async="async" src="http://localhost/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" 38 style="display:block" 39 data-ad-client="ca-pub-3129977114552745" 40 data-ad-slot="6345125851" 41 data-ad-format="auto"></ins> 42 <script> 43 (adsbygoogle = window.adsbygoogle || []).push({}); 44 </script> 45 <nav class="magick-nav"> 46 <a class="magick-nav-item " href="../index.html">Home</a> 47 <a class="magick-nav-item " href="../binary-releases.html">Download</a> 48 <a class="magick-nav-item " href="../command-line-tools.html">Tools</a> 49 <a class="magick-nav-item " href="../command-line-processing.html">Command-line</a> 50 <a class="magick-nav-item " href="../resources.html">Resources</a> 51 <a class="magick-nav-item " href="api.html">Develop</a> 52 <a class="magick-nav-item " href="http://www.imagemagick.org/script/search.php">Search</a> 53 <a class="magick-nav-item pull-right" href="https://www.imagemagick.org/discourse-server/">Community</a> 54 </nav> 55 </div> 56</div> 57<div class="container"> 58<div class="magick-header"> 59<p class="text-center"><a href="channel.html#ChannelFxImage">ChannelFxImage</a> • <a href="channel.html#CombineImages">CombineImages</a> • <a href="channel.html#GetImageAlphaChannel">GetImageAlphaChannel</a> • <a href="channel.html#SeparateImage">SeparateImage</a> • <a href="channel.html#SeparateImages">SeparateImages</a> • <a href="channel.html#SetImageAlphaChannel">SetImageAlphaChannel</a></p> 60 61<h2><a href="http://www.imagemagick.org/api/MagickCore/channel_8c.html" id="ChannelFxImage">ChannelFxImage</a></h2> 62 63<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> 64 65<dd> 66</dd> 67 68<dd> <=> exchange two channels (e.g. red<=>blue) => copy one channel to another channel (e.g. red=>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> 69 70<dd> For example, to create 3 grayscale images from the red, green, and blue channels of an image, use: </dd> 71 72<pre class="text"> 73 -channel-fx "red; green; blue" 74</pre> 75 76<p>A channel without an operation symbol implies separate (i.e, semicolon). </dd> 77 78<dd> The format of the ChannelFxImage method is: </dd> 79 80<pre class="text"> 81Image *ChannelFxImage(const Image *image,const char *expression, 82 ExceptionInfo *exception) 83</pre> 84 85<p>A description of each parameter follows: </dd> 86 87<dd> 88</dd> 89 90<dd> </dd> 91<dl class="dl-horizontal"> 92<dt>image</dt> 93<dd>the image. </dd> 94 95<dd> </dd> 96<dt>expression</dt> 97<dd>A channel expression. </dd> 98 99<dd> </dd> 100<dt>exception</dt> 101<dd>return any errors or warnings in this structure. </dd> 102 103<dd> </dd> 104</dl> 105<h2><a href="http://www.imagemagick.org/api/MagickCore/channel_8c.html" id="CombineImages">CombineImages</a></h2> 106 107<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 => Red, 2 => Green, 3 => Blue, etc.</p> 108 109<p>The format of the CombineImages method is:</p> 110 111<pre class="text"> 112Image *CombineImages(const Image *images,const ColorspaceType colorspace, 113 ExceptionInfo *exception) 114</pre> 115 116<p>A description of each parameter follows:</p> 117 118<dd> 119</dd> 120 121<dd> </dd> 122<dl class="dl-horizontal"> 123<dt>images</dt> 124<dd>the image sequence. </dd> 125 126<dd> </dd> 127<dt>colorspace</dt> 128<dd>the image colorspace. </dd> 129 130<dd> </dd> 131<dt>exception</dt> 132<dd>return any errors or warnings in this structure. </dd> 133 134<dd> </dd> 135</dl> 136<h2><a href="http://www.imagemagick.org/api/MagickCore/channel_8c.html" id="GetImageAlphaChannel">GetImageAlphaChannel</a></h2> 137 138<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> 139 140<p>The format of the GetImageAlphaChannel method is:</p> 141 142<pre class="text"> 143MagickBooleanType GetImageAlphaChannel(const Image *image) 144</pre> 145 146<p>A description of each parameter follows:</p> 147 148<dd> 149</dd> 150 151<dd> </dd> 152<dl class="dl-horizontal"> 153<dt>image</dt> 154<dd>the image. </dd> 155 156<dd> </dd> 157</dl> 158<h2><a href="http://www.imagemagick.org/api/MagickCore/channel_8c.html" id="SeparateImage">SeparateImage</a></h2> 159 160<p>SeparateImage() separates a channel from the image and returns it as a grayscale image.</p> 161 162<p>The format of the SeparateImage method is:</p> 163 164<pre class="text"> 165Image *SeparateImage(const Image *image,const ChannelType channel, 166 ExceptionInfo *exception) 167</pre> 168 169<p>A description of each parameter follows:</p> 170 171<dd> 172</dd> 173 174<dd> </dd> 175<dl class="dl-horizontal"> 176<dt>image</dt> 177<dd>the image. </dd> 178 179<dd> </dd> 180<dt>channel</dt> 181<dd>the image channel. </dd> 182 183<dd> </dd> 184<dt>exception</dt> 185<dd>return any errors or warnings in this structure. </dd> 186 187<dd> </dd> 188</dl> 189<h2><a href="http://www.imagemagick.org/api/MagickCore/channel_8c.html" id="SeparateImages">SeparateImages</a></h2> 190 191<p>SeparateImages() returns a separate grayscale image for each channel specified.</p> 192 193<p>The format of the SeparateImages method is:</p> 194 195<pre class="text"> 196Image *SeparateImages(const Image *image,ExceptionInfo *exception) 197</pre> 198 199<p>A description of each parameter follows:</p> 200 201<dd> 202</dd> 203 204<dd> </dd> 205<dl class="dl-horizontal"> 206<dt>image</dt> 207<dd>the image. </dd> 208 209<dd> </dd> 210<dt>exception</dt> 211<dd>return any errors or warnings in this structure. </dd> 212 213<dd> </dd> 214</dl> 215<h2><a href="http://www.imagemagick.org/api/MagickCore/channel_8c.html" id="SetImageAlphaChannel">SetImageAlphaChannel</a></h2> 216 217<p>SetImageAlphaChannel() activates, deactivates, resets, or sets the alpha channel.</p> 218 219<p>The format of the SetImageAlphaChannel method is:</p> 220 221<pre class="text"> 222MagickBooleanType SetImageAlphaChannel(Image *image, 223 const AlphaChannelOption alpha_type,ExceptionInfo *exception) 224</pre> 225 226<p>A description of each parameter follows:</p> 227 228<dd> 229</dd> 230 231<dd> </dd> 232<dl class="dl-horizontal"> 233<dt>image</dt> 234<dd>the image. </dd> 235 236<dd> </dd> 237<dt>alpha_type</dt> 238<dd> The alpha channel type: ActivateAlphaChannel, AssociateAlphaChannel, CopyAlphaChannel, DeactivateAlphaChannel, DisassociateAlphaChannel, ExtractAlphaChannel, OffAlphaChannel, OnAlphaChannel, OpaqueAlphaChannel, SetAlphaChannel, ShapeAlphaChannel, and TransparentAlphaChannel. </dd> 239 240<dd> </dd> 241<dt>exception</dt> 242<dd>return any errors or warnings in this structure. </dd> 243 244<dd> </dd> 245</dl> 246</div> 247 <footer class="magick-footer"> 248 <p><a href="../support.html">Donate</a> • 249 <a href="../sitemap.html">Sitemap</a> • 250 <a href="../links.html">Related</a> • 251 <a href="../architecture.html">Architecture</a> 252</p> 253 <p><a href="channel.html#">Back to top</a> • 254 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> • 255 <a href="http://www.imagemagick.org/script/contact.php">Contact Us</a></p> 256 <p><small>© 1999-2016 ImageMagick Studio LLC</small></p> 257 </footer> 258</div><!-- /.container --> 259 260 <script src="https://localhost/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 261 <script src="../js/magick.html"></script> 262</div> 263</body> 264</html> 265