module

CrImage::Operation::ChannelSwap

Swaps channels of ChannelType supported by an image

Taking sample image:

Woman with black turtleneck and white background
image.channel_swap(:green, :red) # Crystal autocasting of symbols to Pluto::ChannelType enum is magic
Channel swapped image swapping the green and red channels

Instance methods

channel_swap(a : ChannelType, b : ChannelType) : self
Source
channel_swap!(a : ChannelType, b : ChannelType) : self
Source