1 2 3 4 5<!DOCTYPE html> 6<html lang="en"> 7<head> 8 <meta charset="utf-8" /> 9 <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,shrink-to-fit=no" /> 10 <title>ImageMagick - MagickCore, C API: Get or Set Image Channels</title> 11 <meta name="application-name" content="ImageMagick" /> 12 <meta name="description" content="Use ImageMagick® to create, edit, compose, and convert bitmap images. Resize an image, crop it, change its shades and colors, add captions, and more." /> 13 <meta name="application-url" content="https://imagemagick.org" /> 14 <meta name="generator" content="PHP" /> 15 <meta name="keywords" content="magickcore, c, api:, 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-2020 ImageMagick Studio LLC" /> 23 <meta name="distribution" content="Global" /> 24 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1" /> 25 <meta property='og:url' content='../../' /> 26 <meta property='og:title' content='ImageMagick' /> 27 <meta property='og:image' content='../../images/logo.png' /> 28 <meta property='og:type' content='website' /> 29 <meta property='og:site_name' content='ImageMagick' /> 30 <meta property='og:description' content="Convert, Edit, or Compose Bitmap Images" /> 31 <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" /> 32 <link href="../www/api/channel.html" rel="canonical" /> 33 <link href="../../www/images/wand.png" rel="icon" /> 34 <link href="../../www/images/wand.ico" rel="shortcut icon" /> 35 <link href="../../www/assets/magick.css" rel="stylesheet" /> 36</head> 37<body> 38 <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark"> 39 <a class="navbar-brand" href="../../"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="../../www/images/wand.ico"/></a> 40 <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsMagick" aria-controls="navbarsMagick" aria-expanded="false" aria-label="Toggle navigation"> 41 <span class="navbar-toggler-icon"></span> 42 </button> 43 44 <div class="navbar-collapse collapse" id="navbarsMagick" style=""> 45 <ul class="navbar-nav mr-auto"> 46 <li class="nav-item "> 47 <a class="nav-link" href="../../www/">Home <span class="sr-only">(current)</span></a> 48 </li> 49 <li class="nav-item "> 50 <a class="nav-link" href="../../www/www/download.html">Download</a> 51 </li> 52 <li class="nav-item "> 53 <a class="nav-link" href="../../www/www/command-line-tools.html">Tools</a> 54 </li> 55 <li class="nav-item "> 56 <a class="nav-link" href="../../www/www/command-line-processing.html">Command-line</a> 57 </li> 58 <li class="nav-item "> 59 <a class="nav-link" href="../../www/www/resources.html">Resources</a> 60 </li> 61 <li class="nav-item "> 62 <a class="nav-link" href="../../www/www/develop.html">Develop</a> 63 </li> 64 <li class="nav-item"> 65 <a class="nav-link" target="_blank" href="https://imagemagick.org/discourse-server/">Community</a> 66 </li> 67 </ul> 68 <form class="form-inline my-2 my-lg-0" action="../../www/www/search.html"> 69 <input class="form-control mr-sm-2" type="text" name="q" placeholder="Search" aria-label="Search"> 70 <button class="btn btn-outline-success my-2 my-sm-0" type="submit" name="sa">Search</button> 71 </form> 72 </div> 73 </nav> 74 <div class="container"> 75 <script async="async" src="https://localhost/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" 76 style="display:block" 77 data-ad-client="ca-pub-3129977114552745" 78 data-ad-slot="6345125851" 79 data-full-width-responsive="true" 80 data-ad-format="horizontal"></ins> 81 <script> 82 (adsbygoogle = window.adsbygoogle || []).push({}); 83 </script> 84 85 </div> 86 87 <main class="container"> 88 <div class="magick-template"> 89<div class="magick-header"> 90<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> 91 92<h2><a href="../../api/MagickCore/channel_8c.html" id="ChannelFxImage">ChannelFxImage</a></h2> 93 94<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> 95 96<dd> 97</dd> 98 99<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> 100 101<dd> For example, to create 3 grayscale images from the red, green, and blue channels of an image, use: </dd> 102 103<pre class="text"> 104 -channel-fx "red; green; blue" 105</pre> 106 107<p>A channel without an operation symbol implies separate (i.e, semicolon). </dd> 108 109<dd> The format of the ChannelFxImage method is: </dd> 110 111<pre class="text"> 112Image *ChannelFxImage(const Image *image,const char *expression, 113 ExceptionInfo *exception) 114</pre> 115 116<p>A description of each parameter follows: </dd> 117 118<dd> 119</dd> 120 121<dd> </dd> 122<dl class="dl-horizontal"> 123<dt>image</dt> 124<dd>the image. </dd> 125 126<dd> </dd> 127<dt>expression</dt> 128<dd>A channel expression. </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="../../api/MagickCore/channel_8c.html" id="CombineImages">CombineImages</a></h2> 137 138<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> 139 140<p>The format of the CombineImages method is:</p> 141 142<pre class="text"> 143Image *CombineImages(const Image *images,const ColorspaceType colorspace, 144 ExceptionInfo *exception) 145</pre> 146 147<p>A description of each parameter follows:</p> 148 149<dd> 150</dd> 151 152<dd> </dd> 153<dl class="dl-horizontal"> 154<dt>images</dt> 155<dd>the image sequence. </dd> 156 157<dd> </dd> 158<dt>colorspace</dt> 159<dd>the image colorspace. </dd> 160 161<dd> </dd> 162<dt>exception</dt> 163<dd>return any errors or warnings in this structure. </dd> 164 165<dd> </dd> 166</dl> 167<h2><a href="../../api/MagickCore/channel_8c.html" id="GetImageAlphaChannel">GetImageAlphaChannel</a></h2> 168 169<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> 170 171<p>The format of the GetImageAlphaChannel method is:</p> 172 173<pre class="text"> 174MagickBooleanType GetImageAlphaChannel(const Image *image) 175</pre> 176 177<p>A description of each parameter follows:</p> 178 179<dd> 180</dd> 181 182<dd> </dd> 183<dl class="dl-horizontal"> 184<dt>image</dt> 185<dd>the image. </dd> 186 187<dd> </dd> 188</dl> 189<h2><a href="../../api/MagickCore/channel_8c.html" id="SeparateImage">SeparateImage</a></h2> 190 191<p>SeparateImage() separates a channel from the image and returns it as a grayscale image.</p> 192 193<p>The format of the SeparateImage method is:</p> 194 195<pre class="text"> 196Image *SeparateImage(const Image *image,const ChannelType channel, 197 ExceptionInfo *exception) 198</pre> 199 200<p>A description of each parameter follows:</p> 201 202<dd> 203</dd> 204 205<dd> </dd> 206<dl class="dl-horizontal"> 207<dt>image</dt> 208<dd>the image. </dd> 209 210<dd> </dd> 211<dt>channel</dt> 212<dd>the image channel. </dd> 213 214<dd> </dd> 215<dt>exception</dt> 216<dd>return any errors or warnings in this structure. </dd> 217 218<dd> </dd> 219</dl> 220<h2><a href="../../api/MagickCore/channel_8c.html" id="SeparateImages">SeparateImages</a></h2> 221 222<p>SeparateImages() returns a separate grayscale image for each channel specified.</p> 223 224<p>The format of the SeparateImages method is:</p> 225 226<pre class="text"> 227Image *SeparateImages(const Image *image,ExceptionInfo *exception) 228</pre> 229 230<p>A description of each parameter follows:</p> 231 232<dd> 233</dd> 234 235<dd> </dd> 236<dl class="dl-horizontal"> 237<dt>image</dt> 238<dd>the image. </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<h2><a href="../../api/MagickCore/channel_8c.html" id="SetImageAlphaChannel">SetImageAlphaChannel</a></h2> 247 248<p>SetImageAlphaChannel() activates, deactivates, resets, or sets the alpha channel.</p> 249 250<p>The format of the SetImageAlphaChannel method is:</p> 251 252<pre class="text"> 253MagickBooleanType SetImageAlphaChannel(Image *image, 254 const AlphaChannelOption alpha_type,ExceptionInfo *exception) 255</pre> 256 257<p>A description of each parameter follows:</p> 258 259<dd> 260</dd> 261 262<dd> </dd> 263<dl class="dl-horizontal"> 264<dt>image</dt> 265<dd>the image. </dd> 266 267<dd> </dd> 268<dt>alpha_type</dt> 269<dd> The alpha channel type: ActivateAlphaChannel, AssociateAlphaChannel, CopyAlphaChannel, DeactivateAlphaChannel, DisassociateAlphaChannel, ExtractAlphaChannel, OffAlphaChannel, OnAlphaChannel, OpaqueAlphaChannel, SetAlphaChannel, ShapeAlphaChannel, and TransparentAlphaChannel. </dd> 270 271<dd> </dd> 272<dt>exception</dt> 273<dd>return any errors or warnings in this structure. </dd> 274 275<dd> </dd> 276</dl> 277</div> 278 </div> 279 </main><!-- /.container --> 280 <footer class="magick-footer"> 281 <p><a href="../../www/www/security-policy.html">Security</a> • 282 <a href="../../www/www/architecture.html">Architecture</a> 283 284 <a href="channel.html#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../../www/images/wand.ico"/></a> 285 286 <a href="../../www/www/links.html">Related</a> • 287 <a href="../../www/www/sitemap.html">Sitemap</a> 288 <br/> 289 <a href="../../www/www/support.html">Donate</a> • 290 <a href="http://pgp.mit.edu/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> • 291 <a href="../../www/www/contact.html">Contact Us</a> 292 <br/> 293 <small>© 1999-2020 ImageMagick Studio LLC</small></p> 294 </footer> 295 296 <!-- Javascript assets --> 297 <script src="../../www/assets/magick.js" crossorigin="anonymous"></script> 298 <script>window.jQuery || document.write('<script src="https://localhost/ajax/libs/jquery/3.4.1/jquery.min.js"><\/script>')</script> 299</body> 300</html> 301<!-- Magick Cache 4th January 2020 17:47 -->