CImage:Chs


The Chs method changes the sign of the pixels in the image.

Syntax

bSuccess = CImage:Chs()

where

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

  

The Chs operation changes positive pixel value to negative ones and vice versa. If the data type is entirely positive, like "byte" or "ushort", this operation does nothing.

Example

The following script loads an image from the file sPath and changes the sign of the pixel values:

I = CImage:new()

-- create a new CImage

I:Open(sPath)

-- load the image from a file named sPath

I:Chs()

-- change the sign of all image pixels

The same result could be accomplished using the - (unary minus) math operator:

I = CImage:new()

-- create a new CImage

I:Open(sPath)

-- load the image from a file named sPath

I = -I

-- change the sign of all image pixels

Related Topics

Math Operators

CImage class