ImageGear v26.5 - Updated March 3, 2025
ImageGear.Core Assembly / ImageGear.Processing Namespace / ImGearRasterProcessing Class / Blend Method / Blend(ImGearRasterPage,Int32,Int32,ImGearRasterPage,Double,ImGearChannelRange) Method
Page to process.
Left margin of blended image.
Top margin of blended image.
Image to blend with page.
A value from 0 to 100 defining the % weight of the pageToBlendWith image to be blended.
Channel range to process.




In This Topic
Blend(ImGearRasterPage,Int32,Int32,ImGearRasterPage,Double,ImGearChannelRange) Method
In This Topic
Blends two images based on the weight (in percents) of the secondary image.
Syntax
'Declaration
 
Public Overloads Shared Sub Blend( _
   ByVal page As ImGearRasterPage, _
   ByVal left As Integer, _
   ByVal top As Integer, _
   ByVal pageToBlendWith As ImGearRasterPage, _
   ByVal weight As Double, _
   ByVal channelsRange As ImGearChannelRange _
) 
 
'Usage
 
Dim page As ImGearRasterPage
Dim left As Integer
Dim top As Integer
Dim pageToBlendWith As ImGearRasterPage
Dim weight As Double
Dim channelsRange As ImGearChannelRange
 
ImGearRasterProcessing.Blend(page, left, top, pageToBlendWith, weight, channelsRange)

Parameters

page
Page to process.
left
Left margin of blended image.
top
Top margin of blended image.
pageToBlendWith
Image to blend with page.
weight
A value from 0 to 100 defining the % weight of the pageToBlendWith image to be blended.
channelsRange
Channel range to process.
Remarks

This method blends the specified channels of page with corresponding channels of pageToBlendWith, using the following formula:

pagePixel = (pagePixel * (100.0 - weight) + pageToBlendPixel * weight) / 100.0

The method validates input pages for further processing according to following logics:

  • This method is applicable to any colorspace, but both images must have the same base colorspace (i.e. upon validation of input images will be considered color channels only - Alpha or Extra channels will be ignored. So, for example, any combination of pages with RGB(A/Ex) colorspaces (e.g. RGB and RGBA) are valid input parameters).
  • This method is applicable to any supported by ImageGear channel depth for given colorspace, but channel depths of both images must be the same.

The method processes the input pages according to following logics:

  • This method processes only specified channels range of input pages. In order to process all image channels, use another overload Blend(ImGearRasterPage,Int32,Int32,ImGearRasterPage,Double).
  • The method blends minimal number of channels, determined by channelsRange and channels count between the images. The remaining out-of-range channels, if any, will not be considered for blending, and:
  • This method does not not provide any special handling for the Alpha channel (i.e. it processes it as ordinary color channel), please use BlendWithAlpha method to blend images using the Alpha channel.

See Also