CImage:Recip CImage:ScaleLinVal

CImage:RgbExtract


The RgbExtract method creates a new image containing a channel from the original color image.

Syntax

bResult = CImage:RgbExtract( chan )

    chan is the channel name, like "R", "G", "B", or "A", or a corresponding number beginning at 1.

    On success, this method returns true.

    On failure, this method returns false.

Example

Suppose that a CImage I exists and has RGB color data type. The following script fragment creates 3 new images, one each for the red, green, and blue channels (channels 1 through 3):

 

S = CImageSet:new()

-- create an image set to hold the images

for i=1, 3 do

-- do for each of the 3 channels

  Ichan = I = I:RgbExtract(i)

-- extract the channel

  S:Append( Ichan )

-- add to the end of the image set

end

 

I = S:GetImage(2)

-- retrieve the green image...

Related Topics

CImage, CImageSet:RgbMerge, ExtractByte