CImage:Div
The Div method divides this image by another image. The result replaces the current image.
bResult = CImage:Div( CImage ) |
This method has a possibility of an illegal divide by 0 operation when the pixel of the other image has a value of 0. Mira traps this condition and substitutes a replacement value into the output pixel. The replacement value is set for math operations using the SetMathErrVal method.
The following script fragment loads two images from files sPath1 and sPath2, divides them, and saves the result of the first image back to its file:
|
-- output pixel set to 1 upon divide by 0 error |
|
-- create a new CImage |
|
-- load the image from the file sPath1 |
|
-- create a new CImage |
|
-- load the second image from the file sPath2 |
|
-- change data type for a more significant result |
|
-- perform the operation on image I |
|
-- save the image |
|
-- remove I from memory |
|
-- remove I2 from memory |