CImage:Mul
The Mul method multiplies this image by another image. The result replaces the current image.
bResult = CImage:Mul( CImage )
TheCImage argument refers to another CImage.
On success, this method returns true.
On failure, this method returns false.
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, multiplying two short images may result in a pixel values above 1 billion and below -1 billion, but limits the result to the range [-32768, 32767]. To avoid this problem, you may wish to call SetPixelType to promote the current image to a "larger" pixel type such as long or float before performing the Mul operation. The fact that the 2 images may differ in pixel type is not a problem.
The following script loads two images from files sPath1 andsPath2 , multiplies them, and saves the result of the first image back to its file. In addition, assume that image 2 has a short pixel type so that overflow can occur if the current image has a pixel type of byte, short, or ushort type. This code avoids that problem:
|
-- create a new CImage |
|
-- create a new CImage |
|
-- load the first image |
|
-- load the second image |
|
-- if byte, short, or ushort |
|
-- convert I to long integer type |
|
|
|
-- perform the operation on image I |
|
|
|
|
|
|
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.