CImage:Addx


The Addx method adds a constant value to the image pixels.

Syntax

bResult = CImage:Addx( x )

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

bullet.gif    On success, this method returns true

bullet.gif    On failure, this method returns false.

Remarks

For the byte, short, and ushort pixel types, Mira handles value overflow by truncating the output pixel value at the maximum for the pixel type. For example, adding 20000 to a "short" type image may produce a pixel value as high as 52767 but Mira caps the result at 32767.

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, adds the value 50.5, and saves the result back to the file:

 

I = new_image()

-- create a new CImage

I:Open(sPath)

-- load the image from a file named sPath

I:Addx( 50.5 )

-- perform the operation

I:Save()

 

Related Topics

CImage class


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.