CImage:Blend
The Blend method blends the pixel values with those of another image. The result replaces the current image.
bResult = CImage:Blend( CImage, nBlend )
TheCImage argument refers to another CImage.
The value nBlend is a percentage.
On success, this method returns true.
On failure, this method returns false.
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:
A value nBlend = 0 reproduces the present image exactly.
A value nBlend = 100 reproduces the other image exactly.
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.
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() |
|