compose_channels
![16,16,1,2,'if(c==0,x,y)' +compose_channels[0] and +compose_channels[0] xor -compose_channels[0] or a c r2dx 256,1 n 0,255](img/_16_16_1_2_if_c_0_x_y_compose_channels_0_and_compose_channels_0_xor_compose_channels_0_or_a_c_r2dx_256_1_n_0_255.png)
This or that but not both
For example the underlined snippet in this pipeline:
gmic 16,16,1,2,'if(c==0,x,y)' -compose_channels and
is equivalent to:
gmic 16,16,1,2,'if(c==0,x,y)' -split c -and[-2,-1]
The first form bypasses split and its concomitant overhead, internally harnessing shared to avoid the image unroll and shuffling.
Example
The top graphic arose from this pipeline:gmic \
-input 16,16,1,2,'if(c==0,x,y)' \
+compose_channels[0] and \
+compose_channels[0] xor \
-compose_channels[0] or \
-append c \
-resize2dx 256,1 \
-normalize. 0,255 \
-output. xormagick.png
-input 16,16,1,2,'if(c==0,x,y)' \
+compose_channels[0] and \
+compose_channels[0] xor \
-compose_channels[0] or \
-append c \
-resize2dx 256,1 \
-normalize. 0,255 \
-output. xormagick.png
Command reference
$ gmic -h compose_channels
compose_channels:
_operator
Compose all channels of each selected image, using specified arithmetic operator (+,-,or,min,...).
Default value: 'operator=+'.
Example:
[#1] image.jpg +compose_channels and
Tutorial: https://gmic.eu/tutorial/compose_channels
compose_channels:
_operator
Compose all channels of each selected image, using specified arithmetic operator (+,-,or,min,...).
Default value: 'operator=+'.
Example:
[#1] image.jpg +compose_channels and
Tutorial: https://gmic.eu/tutorial/compose_channels
operator: Any binary arithmetic, logical or comparison test operator that takes a pair of image operands and produces a single result.
One writes the operator without any leading hyphens as it is being passed as a parameter rather than being immediately invoked. Figuratively, the command inserts N − 1 copies of the operator between the N channels of an image, and then reduces the result pairwise from channel zero, accumulating the result in channel zero.It is a harmless yet pointless exercise to employ a single channel image with compose_channels, a bit like the sound of one hand clapping. In this case, such an image is left unchanged by the command. On the other hand, the G'MIC command passed to compose_channels really must be a pairwise image operator that reduces a multi-spectral operand image to a single channel result. Unpredictable behavior can arise, though an inappropriate command usually results in a error.


Home
Download
News
Mastodon
Bluesky
X
Summary - 17 Years
Summary - 16 Years
Summary - 15 Years
Summary - 13 Years
Summary - 11 Years
Summary - 10 Years
Resources
Technical Reference
Scripting Tutorial
Video Tutorials
Wiki Pages
Image Gallery
Color Presets
Using libgmic
G'MIC Online
Community
Discussion Forum (Pixls.us)
GimpChat
IRC
Report Issue