CImage:Blendx


The Blendx method blends the pixel values with a constant value. An interpolation is performed between each pixel value and the number

Syntax

bResult = CImage:Blendx( x, nBlend )

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

bullet.gif    The interpolation value nBlend is a percentage.

bullet.gif    On success, this method returns true

bullet.gif    On failure, this method returns false.

Remarks

The result of this operation is a "dilution" of the pixel value relative to the constant. The interpolation constant nBlend measures the distance between the pixel value and the pure number x. For each image pixel, the result is as follows:

bullet.gif    A value nBlend=0 reproduces the pixel value exactly.

bullet.gif    A value nBlend=100 reproduces the constant value exactly.

Similarly a value nBlend=50 produces a result midway between the pixel value and the constant x. Values outside the range [0,1] extrapolate by effectively removing the pixel value from the number or by removing the number from the pixel value.

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, blends the pixel values equally (50%) with the number 1000, 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:Blendx( 1000, 50 )

-- perform the operation

I:Save()

 

Related Topics

CImage


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