Write Extra Channel

TIFF Extra Channels Write Bitmap

Creates a TIFF image with an extra channel.

Сode Snippet

using (var reader = new TiffReader("Copenhagen_Resized.tif"))
using (var writer = new TiffWriter("CopenhagenWithExtraChannel.tif"))
{
    // Load bitmap for the extra channel.
    // Note: image for extra channel must be grayscale and have the same dimensions and DPI as the source one.
    using (var extraBitmap = new Bitmap("Copenhagen_Extra.tif"))
    {
        // Create extra channel options based on extraBitmap.
        var extraChannel = new TiffExtraChannelEntry(extraBitmap, TiffChannelType.Alpha);

        writer.ExtraChannels.Add(extraChannel);
        Pipeline.Run(reader + writer);
    }
}

Input

Copenhagen_Resized.tif

Download

Copenhagen_Extra.tif

Download

Output

CopenhagenWithExtraChannel.tif

Download

For AI-assisted development: Download Graphics Mill Code Samples XML Catalog