Image: Arithmetic Transform: Alpha Blend
Blend two images to form composite image
This feature is for OriginPro only.
1. imgBlend img:=[Mbook1]1!mat(1) imgb:=[Mbook2]1!mat(1) opacity:=120;
2. imgBlend img:=[Mbook1]1!mat(1) imgb:=[Mbook2]1!mat(1) x:=50 y:=10;
Please refer to the page for additional option switches when accessing the x-function from script
Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
---|---|---|---|---|
Input Matrix | img |
Input Image |
|
Specifies the input image to be manipulated. The default input is the active image. |
Image to Blend | imgb |
Input Image |
|
Specifies an image used to blend the input image. |
Opacity | opacity |
Input int |
|
Specifies the opacity of the Image to Blend. This value should be between 0 and 255. |
Output Image | oimg |
Output Image |
|
Specifies the output image. By default, a new image will be created and used as output. See the syntax here. |
Offset X | x |
Input int |
|
Specifies the vertical offset to change the relative position of the Image to Blend. |
Offset Y | y |
Input int |
|
Specifies the horizontal offset to change the relative position of the Image to Blend. |
Crop to Common Area | crop |
Input int |
|
Specifies whether to crop the output image to the common area of Input Image and Image to Blend. |
A use of alpha blending is adding visual objects to a background image. This X-Function combines two images with a constant opacity: the first image is referred to as "Input Image" and the other one is referred to as "Image to Blend". The Image to Blend is made transparent and put on top of the Input Image, allowing user to see through the image on top to the image below. This tool allows you to set the opacity and the offset of the image to blend. In addition, it allows you decide whether to output the whole blended image or only the common area of the two images.
In this example, we use the imgBlend function to combine two images (one in Mbook3 and the other in Mbook2):
Note: OriginPro includes the ability to automatically recalculate the analysis result of the Alpha Blending operation any time you change the parameters or update your source data. In addition, the settings for the analysis routine can be saved to an analysis theme for use later with similar data.
The computation uses L_AlphaBlendBitmap() function from LEADTOOLS Main API. Please refer to the LEADTOOLS Main API Help file, Version 14 and read the L_AlphaBlendBitmap topic.
LEADTOOLS Main API Help file, Version 14