CImage:Xdiv


The Xdiv method divides a constant value by each of the image pixels. The results replace the pixels of the image.

Syntax

bSuccess = CImage:Xdiv( x )

where

    value is a number or a string that can be converted to a number.

    bSuccess is the returned success code. On success it is true, otherwise false.

  

Usually, the image should have real type pixels before using this method. The pixel data type can be tested and changed using IsReal and SetDatatype . See Data Types for more information.

The value x can be passed as a numeric value or a string. Using a string is the only way to pass an rgb color value but it may also be used for numeric type images.

Example

The following script loads an image from the file sPath, divides into 1.0, and saves the result back to the file. This produces an image that is the reciprocal of the original image:

I = CImage:new()

-- create a new CImage

I:Open(sPath)

-- load the image from a file named sPath

I:Xdiv( 15.0 )

-- divide all the pixels into 15.0

I:Save()

 

Related Topics

Div

Recip

CImage class