ImageMagick (legacy) – MagickCore, C API: Get or Set Image Channels
Author: ImageMagick Studio LLC
Description: Create, Edit, Compose, or Convert Digital Images
Keywords: magickcore, c, api:, get, or, set, image, channels, image processing software

CombineImages • GetImageAlphaChannel • SeparateImageChannel • SeparateImages • SetImageAlphaChannel

## CombineImages

CombineImages() combines one or more images into a single image. The grayscale value of the pixels of each image in the sequence is assigned in order to the specified channels of the combined image. The typical ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.

The format of the CombineImages method is:

    Image *CombineImages(const Image *image,const ChannelType channel,
      ExceptionInfo *exception)

A description of each parameter follows:

image
  the image.
exception
  return any errors or warnings in this structure.

## GetImageAlphaChannel

GetImageAlphaChannel() returns MagickFalse if the image alpha channel is not activated. That is, the image is RGB rather than RGBA or CMYK rather than CMYKA.

The format of the GetImageAlphaChannel method is:

    MagickBooleanType GetImageAlphaChannel(const Image *image)

A description of each parameter follows:

image
  the image.

## SeparateImageChannel

SeparateImageChannel() separates a channel from the image and returns it as a grayscale image. A channel is a particular color component of each pixel in the image.

The format of the SeparateImageChannel method is:

    MagickBooleanType SeparateImageChannel(Image *image,
      const ChannelType channel)

A description of each parameter follows:

image
  the image.
channel
  Identify which channel to extract: RedChannel, GreenChannel, BlueChannel, OpacityChannel, CyanChannel, MagentaChannel, YellowChannel, or BlackChannel.

## SeparateImages

SeparateImages() returns a separate grayscale image for each channel specified.

The format of the SeparateImages method is:

    MagickBooleanType SeparateImages(const Image *image,
      const ChannelType channel,ExceptionInfo *exception)

A description of each parameter follows:

image
  the image.
channel
  Identify which channels to extract: RedChannel, GreenChannel, BlueChannel, OpacityChannel, CyanChannel, MagentaChannel, YellowChannel, or BlackChannel.
exception
  return any errors or warnings in this structure.

## SetImageAlphaChannel

SetImageAlphaChannel() activates, deactivates, resets, or sets the alpha channel.

The format of the SetImageAlphaChannel method is:

    MagickBooleanType SetImageAlphaChannel(Image *image,
      const AlphaChannelType alpha_type)

A description of each parameter follows:

image
  the image.
alpha_type
  The alpha channel type: ActivateAlphaChannel, AssociateAlphaChannel, CopyAlphaChannel, Disassociate, DeactivateAlphaChannel, ExtractAlphaChannel, OpaqueAlphaChannel, ResetAlphaChannel, SetAlphaChannel, ShapeAlphaChannel, and TransparentAlphaChannel.