CImage:Blend CImage:Byteswap

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 )

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

    The interpolation value nBlend is a percentage.

    On success, this method returns true

    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:

    A value nBlend=0 reproduces the pixel value exactly.

    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 fragment 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 = CImage:new()

-- 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