CImage:Log10 CImage:Modx

CImage:Mod


The Mod method computes the remainder of dividing the image by a second "operand" image. The result replaces the current image.

Syntax

bResult = CImage:Mod( CImage )

    TheCImage argument refers to the operand CImage.

    On success, this method returns true.

    On failure, this method returns false.

Remarks

This method has a possibility of an illegal divide by 0 operation when the pixel of the operand 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.

Example

The following script fragment loads two images from files sPath1 and sPath2, Mods them equally usingnMod = 50, and saves the result of the first image back to its file:

 

SetMathErrVal( 1 )

-- sets the output pixel to 1 upon divide by 0 error.

I = CImage:new()

-- create a new CImage

I2 = CImage:new()

-- 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:Mod( I2 )

-- perform the operation on image I

I:Save()

 

I:delete()

 

I2:delete()

 

Related Topics

CImage