CImage:ExtractByte


The ExtractByte method creates a new image containing a byte plane from a numeric image. For example, this creates an image consisting of the high order byte of a ushort type image.

Syntax

CImage = CImage:ExtractByte( nPlane )

bullet.gif    nPlane is the plane number, beginning at 1.

bullet.gif    On success, this method returns a new CImage object.

bullet.gif    On failure, this method returns nil.

Example

Suppose that a CImage I exists and has long pixel type. The following script creates 4 new images, one each for the 4 bytes of the original image pixels:

 

S = new_imageset()

-- create an image set to hold the images

for i=1, 4 do

-- do for each of the 3 channels

  Iplane = I:ExtractByte(i)

-- extract the byte plane to a new image

  S:Append( Iplane )

-- add to the end of the image set

end

 

I = S:GetImage(1)

-- retrieve the lowest order byte plane

Related Topics

CImage class, ExtractChan, Pixel Types


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.