CImage:Close CImage:Display

CImage:Create


The Create method constructs a new image of specified properties and attaches it to the CImage object. Until saved, the image is not associated with any file. The image should be removed from memory using the class methods Close or delete.

Syntax

bTrue = CImage:Create( nCols, sDatatype )

bTrue = CImage:Create( nCols, nRows, sDatatype )

    nCols is the number of columns in the image.

    nRows is the number of rows in the image.

    sDatatype is a string that describes the image data type (e.g., "16 bit unsigned")

    On success, this method returns true.

    On failure, this method returns false.

Remarks

The image is created with the pixel values set to 0. You can change all, most, or some of the pixel values using the SetRegionVal and SetVal methods.

Example

I = CImage:new()

-- create a CImage object

bOk = I:Create(100,200,"ushort")

-- Create a 100x200 image of type "ushort"

if ( not bOk ) then

-- if not created, then...

  Exit()

-- leave the script, etc.

end

-- end of if block

I:SetRegionVal( 2000 )

-- to change the pixel values

Related Topics

CImage, Attach, Open