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 )

bullet.gif    TheCImage argument refers to another CImage.

bullet.gif    The value nBlend is a percentage.

bullet.gif    On success, this method returns true.

bullet.gif    On failure, this method returns false.

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 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 = new_image()

-- create a new CImage

I2 = new_image()

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


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