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 )

bullet.gif    nCols is the number of columns in the image.

bullet.gif    nRows is the number of rows in the image if 2 dimensional.

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

bullet.gif    On success, this method returns true.

bullet.gif    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 = new_image()

-- 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 class, Open, Copy, new_image, attachlist_image

 


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