ImageGear v26.5 - Updated March 3, 2025
ImageGear.Core Assembly / ImageGear.Processing Namespace / ImGearRasterProcessing Class / UpdateChannelFrom Method
Destination channel.
Source channel.
Example




In This Topic
UpdateChannelFrom Method
In This Topic
Copies channel from channel referenced by channelUpdateWith to the channel referenced by channelToUpdate. The pages containing both channels must have the same width and height.
Syntax
'Declaration
 
Public Shared Sub UpdateChannelFrom( _
   ByVal channelToUpdate As ImGearChannelRef, _
   ByVal channelUpdateWith As ImGearChannelRef _
) 
 
'Usage
 
Dim channelToUpdate As ImGearChannelRef
Dim channelUpdateWith As ImGearChannelRef
 
ImGearRasterProcessing.UpdateChannelFrom(channelToUpdate, channelUpdateWith)

Parameters

channelToUpdate
Destination channel.
channelUpdateWith
Source channel.
Example
// Separate original image into separate images for each channel.
ImGearChannelRef[] igChannelRefOriginal = ImGearRasterProcessing.SeparateChannels(igRasterPage);
// Save what the colorspace was of the image.
ImGearColorSpaceIDs igColorSpaceID = igRasterPage.DIB.ColorSpace.Value;
// Create a blank image with the same attributes as the original image.
ImGearRasterPage igRasterPageNew = new ImGearRasterPage(
    igRasterPage.DIB.Width, igRasterPage.DIB.Height,
    new ImGearColorSpace(igColorSpaceID),
    (int[])igRasterPage.DIB.ChannelDepths.Clone(), true);
// Separate new image into separate images for each channel.
ImGearChannelRef[] igChannelRefNew = ImGearRasterProcessing.SeparateChannels(igRasterPageNew);
// Update the first channel of the new image from the original image.
ImGearRasterProcessing.UpdateChannelFrom(igChannelRefNew[0], igChannelRefOriginal[0]);
// Combine channels back into new image.
igRasterPageNew = ImGearRasterProcessing.CombineChannels(
    new ImGearColorSpace(igColorSpaceID), igChannelRefNew);
See Also