ImageGear .NET - Updated
CombineChannels Method
Example 




ImageGear24.Core Assembly > ImageGear.Processing Namespace > ImGearRasterProcessing Class : CombineChannels Method
Color space of the resulting multichannel page.
Array of channels reference to combine to multichannel page.
Combines image channels according to the specified color space.
Syntax
'Declaration
 
Public Shared Function CombineChannels( _
   ByVal space As ImGearColorSpace, _
   ByVal channels() As ImGearChannelRef _
) As ImGearRasterPage
'Usage
 
Dim space As ImGearColorSpace
Dim channels() As ImGearChannelRef
Dim value As ImGearRasterPage
 
value = ImGearRasterProcessing.CombineChannels(space, channels)
public static ImGearRasterPage CombineChannels( 
   ImGearColorSpace space,
   ImGearChannelRef[] channels
)
public: static ImGearRasterPage* CombineChannels( 
   ImGearColorSpace space,
   ImGearChannelRef[]* channels
) 
public:
static ImGearRasterPage^ CombineChannels( 
   ImGearColorSpace space,
   array<ImGearChannelRef>^ channels
) 

Parameters

space
Color space of the resulting multichannel page.
channels
Array of channels reference to combine to multichannel page.

Return Value

Remarks
This method puts together image channels according to the destination color space specified by the space parameter. This method does not do any color space or pixel conversions, it merely merges pixel data from different channels together. The number of channel pages should be compatible with the destination color space. Each Page in ChannelPages array must have exactly one channel. All pages must have the same BitsPerChannel and dimensions.
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);
' Separate original image into separate images for each channel.
Dim igChannelRefOriginal As ImGearChannelRef() = ImGearRasterProcessing.SeparateChannels(igRasterPage)
' Save what the colorspace was of the image.
Dim igColorSpaceID As ImGearColorSpaceIDs = igRasterPage.DIB.ColorSpace.Value
' Create a blank image with the same attributes as the original image.
Dim igRasterPageNew As New ImGearRasterPage( _
 igRasterPage.DIB.Width, igRasterPage.DIB.Height, New ImGearColorSpace(igColorSpaceID), _
 DirectCast(igRasterPage.DIB.ChannelDepths.Clone(), Integer()), True)
' Separate new image into separate images for each channel.
Dim igChannelRefNew As ImGearChannelRef() = 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

Reference

ImGearRasterProcessing Class
ImGearRasterProcessing Members
ImGearRasterPage Class
ImGearColorSpace Structure
ImGearChannelRef Structure