CImage:Add


The Add method adds this image to another image. The result replaces the current image.

Syntax

bResult = CImage:Add( CImage )

Remarks

For the byte, short, and ushort Pixel Types, Mira handles value overflow by truncating the output pixel value at the limits for the pixel type. For example, adding two short images may result in a pixel value as high as 65534 but Mira caps the result at 32767. If there is a chance of overflow and you want to accommodate the values, use SetPixelType to change to a "larger" pixel type before calling Sub.

Example

The following script loads two images from files sPath1 and sPath2, Adds them, and saves the result of the first image back to its file:

 

I = new_image()

-- create a new CImage

I2 = new_image()

-- create a new CImage

I:Open(sPath1)

-- load the first image from a file named sPath1

I2:Open(sPath2)

-- load the second image from a file named sPath2

I:Add( I2 )

-- perform the operation on image I

I:Save()

 

I:delete()

 

I2:delete()

 

Related Topics

CImage class


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