blob: 037455830e25d98836bf62bcfdb295d9eaf83400 [file] [log] [blame]
Cristy594d2772015-11-15 10:47:42 -05001
2
3
4
cristy29dc8652015-05-12 16:26:21 +00005<!DOCTYPE html>
cristy44443b92015-05-05 00:06:07 +00006<html lang="en">
cristy8ee7f242013-06-20 16:08:44 +00007<head>
Cristy594d2772015-11-15 10:47:42 -05008 <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
cristy29f2c972015-07-28 13:37:46 +00009 <title>ImageMagick: MagickCore, C API for ImageMagick: Get or Set Image Channels</title>
Cristy594d2772015-11-15 10:47:42 -050010 <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 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:, 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"/>
Cristyce4a3552015-12-14 13:53:35 -050022 <meta name="copyright" content="Copyright (c) 1999-2015 ImageMagick Studio LLC"/>
Cristy594d2772015-11-15 10:47:42 -050023 <meta name="distribution" content="Global"/>
24 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1"/>
25 <link rel="icon" href="../images/wand.png"/>
26 <link rel="shortcut icon" href="../images/wand.ico"/>
27 <link rel="stylesheet" href="../css/magick.html"/>
cristy8ee7f242013-06-20 16:08:44 +000028</head>
cristy44443b92015-05-05 00:06:07 +000029<body>
cristy8ee7f242013-06-20 16:08:44 +000030<div class="main">
cristy44443b92015-05-05 00:06:07 +000031<div class="magick-masthead">
32 <div class="container">
Cristye93be682015-11-26 09:07:51 -050033 <script async="async" src="http://localhost/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle"
Cristy594d2772015-11-15 10:47:42 -050034 style="display:block"
35 data-ad-client="ca-pub-3129977114552745"
36 data-ad-slot="6345125851"
37 data-ad-format="auto"></ins>
cristy29f2c972015-07-28 13:37:46 +000038 <script>
Cristy542697a2015-10-12 20:10:32 -040039 (adsbygoogle = window.adsbygoogle || []).push({});
cristy44443b92015-05-05 00:06:07 +000040 </script>
cristy44443b92015-05-05 00:06:07 +000041 <nav class="magick-nav">
cristy2f563d42015-05-06 23:36:51 +000042 <a class="magick-nav-item " href="../index.html">Home</a>
cristyea2793e2015-05-31 16:52:26 +000043 <a class="magick-nav-item " href="../binary-releases.html">Download</a>
cristy38185362015-05-07 20:09:56 +000044 <a class="magick-nav-item " href="../command-line-tools.html">Tools</a>
Cristye93be682015-11-26 09:07:51 -050045 <a class="magick-nav-item " href="../command-line-processing.html">Command-line</a>
cristyea2793e2015-05-31 16:52:26 +000046 <a class="magick-nav-item " href="../resources.html">Resources</a>
47 <a class="magick-nav-item " href="api.html">Develop</a>
cristy5b8fe762015-06-09 16:24:03 +000048 <a class="magick-nav-item " href="http://nextgen.imagemagick.org/script/search.php">Search</a>
cristya1890f02015-05-15 23:32:44 +000049 <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a>
cristy44443b92015-05-05 00:06:07 +000050 </nav>
51 </div>
52</div>
53<div class="container">
cristy4e638cd2015-05-07 16:47:40 +000054<div class="magick-header">
Cristy594d2772015-11-15 10:47:42 -050055<p class="text-center"><a href="channel.html#ChannelFxImage">ChannelFxImage</a> &#8226; <a href="channel.html#CombineImages">CombineImages</a> &#8226; <a href="channel.html#GetImageAlphaChannel">GetImageAlphaChannel</a> &#8226; <a href="channel.html#SeparateImage">SeparateImage</a> &#8226; <a href="channel.html#SeparateImages">SeparateImages</a> &#8226; <a href="channel.html#SetImageAlphaChannel">SetImageAlphaChannel</a></p>
cristy8ee7f242013-06-20 16:08:44 +000056
Cristye93be682015-11-26 09:07:51 -050057<h2><a href="http://www.imagemagick.org/api/MagickCore/channel_8c.html" id="ChannelFxImage">ChannelFxImage</a></h2>
cristycecc9492015-06-09 16:53:50 +000058
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
Cristy594d2772015-11-15 10:47:42 -050072<p>A channel without an operation symbol implies separate (i.e, semicolon). </dd>
cristycecc9492015-06-09 16:53:50 +000073
Cristy594d2772015-11-15 10:47:42 -050074<dd> The format of the ChannelFxImage method is: </dd>
cristycecc9492015-06-09 16:53:50 +000075
76<pre class="text">
77Image *ChannelFxImage(const Image *image,const char *expression,
78 ExceptionInfo *exception)
79</pre>
80
Cristy594d2772015-11-15 10:47:42 -050081<p>A description of each parameter follows: </dd>
cristycecc9492015-06-09 16:53:50 +000082
Cristy594d2772015-11-15 10:47:42 -050083<dd>
cristycecc9492015-06-09 16:53:50 +000084</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>
Cristye93be682015-11-26 09:07:51 -0500101<h2><a href="http://www.imagemagick.org/api/MagickCore/channel_8c.html" id="CombineImages">CombineImages</a></h2>
cristy8ee7f242013-06-20 16:08:44 +0000102
cristy44cbd482013-08-04 20:53:36 +0000103<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>
cristy8ee7f242013-06-20 16:08:44 +0000104
105<p>The format of the CombineImages method is:</p>
106
cristy44443b92015-05-05 00:06:07 +0000107<pre class="text">
cristycecc9492015-06-09 16:53:50 +0000108Image *CombineImages(const Image *images,const ColorspaceType colorspace,
cristy44443b92015-05-05 00:06:07 +0000109 ExceptionInfo *exception)
cristy8ee7f242013-06-20 16:08:44 +0000110</pre>
111
112<p>A description of each parameter follows:</p>
113
cristy44443b92015-05-05 00:06:07 +0000114<dd>
115</dd>
cristy8ee7f242013-06-20 16:08:44 +0000116
cristy44443b92015-05-05 00:06:07 +0000117<dd> </dd>
118<dl class="dl-horizontal">
cristycecc9492015-06-09 16:53:50 +0000119<dt>images</dt>
120<dd>the image sequence. </dd>
121
122<dd> </dd>
123<dt>colorspace</dt>
124<dd>the image colorspace. </dd>
cristy8ee7f242013-06-20 16:08:44 +0000125
cristy44443b92015-05-05 00:06:07 +0000126<dd> </dd>
127<dt>exception</dt>
128<dd>return any errors or warnings in this structure. </dd>
129
130<dd> </dd>
131</dl>
Cristye93be682015-11-26 09:07:51 -0500132<h2><a href="http://www.imagemagick.org/api/MagickCore/channel_8c.html" id="GetImageAlphaChannel">GetImageAlphaChannel</a></h2>
cristy8ee7f242013-06-20 16:08:44 +0000133
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
cristy44443b92015-05-05 00:06:07 +0000138<pre class="text">
139MagickBooleanType GetImageAlphaChannel(const Image *image)
cristy8ee7f242013-06-20 16:08:44 +0000140</pre>
141
142<p>A description of each parameter follows:</p>
143
cristy44443b92015-05-05 00:06:07 +0000144<dd>
145</dd>
cristy8ee7f242013-06-20 16:08:44 +0000146
cristy44443b92015-05-05 00:06:07 +0000147<dd> </dd>
148<dl class="dl-horizontal">
149<dt>image</dt>
150<dd>the image. </dd>
151
152<dd> </dd>
153</dl>
Cristye93be682015-11-26 09:07:51 -0500154<h2><a href="http://www.imagemagick.org/api/MagickCore/channel_8c.html" id="SeparateImage">SeparateImage</a></h2>
cristy8ee7f242013-06-20 16:08:44 +0000155
cristycecc9492015-06-09 16:53:50 +0000156<p>SeparateImage() separates a channel from the image and returns it as a grayscale image.</p>
cristy8ee7f242013-06-20 16:08:44 +0000157
cristycecc9492015-06-09 16:53:50 +0000158<p>The format of the SeparateImage method is:</p>
cristy8ee7f242013-06-20 16:08:44 +0000159
cristy44443b92015-05-05 00:06:07 +0000160<pre class="text">
cristycecc9492015-06-09 16:53:50 +0000161Image *SeparateImage(const Image *image,const ChannelType channel,
162 ExceptionInfo *exception)
cristy8ee7f242013-06-20 16:08:44 +0000163</pre>
164
165<p>A description of each parameter follows:</p>
166
cristy44443b92015-05-05 00:06:07 +0000167<dd>
168</dd>
cristy8ee7f242013-06-20 16:08:44 +0000169
cristy44443b92015-05-05 00:06:07 +0000170<dd> </dd>
171<dl class="dl-horizontal">
172<dt>image</dt>
173<dd>the image. </dd>
cristy8ee7f242013-06-20 16:08:44 +0000174
cristy44443b92015-05-05 00:06:07 +0000175<dd> </dd>
176<dt>channel</dt>
cristycecc9492015-06-09 16:53:50 +0000177<dd>the image channel. </dd>
cristy8ee7f242013-06-20 16:08:44 +0000178
cristy44443b92015-05-05 00:06:07 +0000179<dd> </dd>
180<dt>exception</dt>
181<dd>return any errors or warnings in this structure. </dd>
182
183<dd> </dd>
184</dl>
Cristye93be682015-11-26 09:07:51 -0500185<h2><a href="http://www.imagemagick.org/api/MagickCore/channel_8c.html" id="SeparateImages">SeparateImages</a></h2>
cristycecc9492015-06-09 16:53:50 +0000186
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">
192Image *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>
Cristye93be682015-11-26 09:07:51 -0500211<h2><a href="http://www.imagemagick.org/api/MagickCore/channel_8c.html" id="SetImageAlphaChannel">SetImageAlphaChannel</a></h2>
cristy8ee7f242013-06-20 16:08:44 +0000212
213<p>SetImageAlphaChannel() activates, deactivates, resets, or sets the alpha channel.</p>
214
215<p>The format of the SetImageAlphaChannel method is:</p>
216
cristy44443b92015-05-05 00:06:07 +0000217<pre class="text">
218MagickBooleanType SetImageAlphaChannel(Image *image,
cristycecc9492015-06-09 16:53:50 +0000219 const AlphaChannelOption alpha_type,ExceptionInfo *exception)
cristy8ee7f242013-06-20 16:08:44 +0000220</pre>
221
222<p>A description of each parameter follows:</p>
223
cristy44443b92015-05-05 00:06:07 +0000224<dd>
225</dd>
cristy8ee7f242013-06-20 16:08:44 +0000226
cristy44443b92015-05-05 00:06:07 +0000227<dd> </dd>
228<dl class="dl-horizontal">
229<dt>image</dt>
230<dd>the image. </dd>
cristy8ee7f242013-06-20 16:08:44 +0000231
cristy44443b92015-05-05 00:06:07 +0000232<dd> </dd>
233<dt>alpha_type</dt>
cristycecc9492015-06-09 16:53:50 +0000234<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>
cristy8ee7f242013-06-20 16:08:44 +0000239
cristy44443b92015-05-05 00:06:07 +0000240<dd> </dd>
241</dl>
cristy8ee7f242013-06-20 16:08:44 +0000242</div>
cristy44443b92015-05-05 00:06:07 +0000243 <footer class="magick-footer">
cristy29f2c972015-07-28 13:37:46 +0000244 <p><a href="../support.html">Donate</a>
245 <a href="../sitemap.html">Sitemap</a>
cristy38185362015-05-07 20:09:56 +0000246 <a href="../links.html">Related</a>
cristy29f2c972015-07-28 13:37:46 +0000247 <a href="../architecture.html">Architecture</a>
cristy44443b92015-05-05 00:06:07 +0000248</p>
249 <p><a href="channel.html#">Back to top</a>
cristyea2793e2015-05-31 16:52:26 +0000250 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a>
cristy5b8fe762015-06-09 16:24:03 +0000251 <a href="http://nextgen.imagemagick.org/script/contact.php">Contact Us</a></p>
Cristyce4a3552015-12-14 13:53:35 -0500252 <p><small>© 1999-2015 ImageMagick Studio LLC</small></p>
cristy44443b92015-05-05 00:06:07 +0000253 </footer>
254</div><!-- /.container -->
cristy8ee7f242013-06-20 16:08:44 +0000255
Cristye93be682015-11-26 09:07:51 -0500256 <script src="https://localhost/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
cristy29f2c972015-07-28 13:37:46 +0000257 <script src="http://nextgen.imagemagick.org/js/magick.html"></script>
cristy44cbd482013-08-04 20:53:36 +0000258</div>
cristy8ee7f242013-06-20 16:08:44 +0000259</body>
cristy5a367e42015-05-05 12:39:18 +0000260</html>