CImage:new
The new method constructs a new instance of a CImage object. You must call new before using any class methods or properties. After creating a new image, you must use the Create, Open, or Copy method from the CImage class or attach it from the CImageView class. Note that the object can also be created using new_image.
CImage = CImage:new() Creates a new CImage. CImage = CImage:new( CImage_old ) This is a copy constructor. It creates a new CImage initialized to the properties of CImage_old. CImage = CImage:new( tbl ) tbl is a lua array (simple 1-dimensional lua table) -- see Tables and Arrays - Overview. All methods return a new CImage object on success. On failure, nil is returned. |
The following script creates a CImage object and loads an image into it. Then it creates a new CImage that is a duplicate of the first one. This makes 2 images loaded into memory:
|
-- create a new CImage object |
|
-- load an image from a file |
|
-- create a new CImage with a copy of A |
|
-- print the name of image A |
|
-- print the name of image B. Same as A |
|
-- delete when done |
|
-- delete when done |
The following script creates a 1-dimensional CImage object from a lua array initialized to 1 million Gaussian deviates (noise). Then the mean and standard deviation of the image are calculated and printed:
|
-- create an array of 1 millian Gaussian deviates |
|
-- create a new CImage with a copy of A |
|
-- calculate the mean and standard deviation |
|
-- print the results |
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.