CImage:Sub CImage:Xdiv

CImage:Subx


The Subx method subtracts a constant value from the image pixels.

Syntax

bResult = CImage:Subx( x )

    The value x may be passed as a number or a string.

    On success, this method returns true

    On failure, this method returns false.

Remarks

Subtracting a value can result in values below 0. If this is a possibility, be sure the data type supports negative values; if not, use SetDatatype to change to a real data type before calling Subx.

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 fragment loads an image from the file sPath, adds the value 50.5, and saves the result back to the file:

 

I = CImage:new()

-- create a new CImage

I:Open(sPath)

-- load the image from a file named sPath

I:Subx( 50.5 )

-- perform the operation

I:Save()

 

Related Topics

CImage