CImage:Addx CImage:Blendx

CImage:Blend


The Blend method blends the pixel values with those of another image. The result replaces the current image.

Syntax

bResult = CImage:Blend( CImage, nBlend )

Remarks

Each pixel value of the CImage is replaced by the result of an interpolation with the corresponding pixel of the second image. This dilutes the image with the other image, or expressed another way, it fades one image into the other. The value nBlend measures the interpolation distance between the two images. For each image pixels, the result is as follows:

Similarly a value x = 50 produces a result midway between thetwo images. Values outside the range [0,100] extrapolate by effectively removing one pixel value from the other.

Example

The following script fragment loads two images from files sPath1 and sPath2, blends them equally usingnBlend = 50, and saves the result of the first image back to its file:

 

I = CImage:new()

-- create a new CImage

I2 = CImage:new()

-- create a new CImage

I:Open(sPath1)

-- load the first image from a file named sPath1

I2:Open(sPath2)

-- load the second image from a file named sPath2

I:Blend( 50 )

-- perform the operation on image I

I:Save()

 

I:delete()

 

I2:delete()

 

Related Topics

CImage