CImage:ExtractChan
The ExtractChan method creates a new image containing a channel from the original color image.
CImage = CImage:ExtractChan( nChan ) where |
nChan is the channel name, like "R", "G", "B", or "A", or a corresponding number beginning at 1.
CImage is a new CImage object containing the extracted channel.
On success, this method returns a new CImage.
On failure, this method return nil.
Suppose that a CImage I exists and has RGB color data type. The following script creates 3 new images, one each for the red, green, and blue channels (channels 1 through 3):
|
-- create an image set to hold the images |
|
-- do for each of the 3 channels |
|
-- extract the channel to a new CImage |
|
-- add to the end of the image set |
|
|
|
-- retrieve the green image... |