KJNodes/imagegenerated

Split Image Channels(SplitImageChannels)

This node takes an IMAGE type tensor containing four RGBA channels as input.

Split Image Channels

image
red
green
blue
mask
KJNodes

The Split Image Channels node receives an IMAGE type tensor containing four RGBA channels as input.

The Split Image Channels node is an image processing tool. Its core function is to separate an input color image (typically containing RGBA channels) into independent red, green, and blue channel images, along with a transparency mask. It extracts and replicates the information from each color channel to generate new grayscale images, while converting the Alpha channel into a separate mask.

Node Functionality

This node receives an IMAGE type tensor containing four RGBA channels as input. Internally, it uses PyTorch operations to extract the red, green, blue, and Alpha channel data separately. For each color channel, the node replicates its single-channel data three times to generate a three-channel grayscale image (all channel values are identical), facilitating continued use within ComfyUI's image processing pipeline. The Alpha channel is extracted separately and converted into a MASK type output.

Node Parameter Description - Split Image Channels

Inputs

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
imageIMAGEYes--The input image tensor containing red, green, blue, and Alpha channels.

Outputs

Parameter NameData TypeDescription
redIMAGEThe output red channel image, a three-channel grayscale image.
greenIMAGEThe output green channel image, a three-channel grayscale image.
blueIMAGEThe output blue channel image, a three-channel grayscale image.
maskMASKThe transparency mask extracted from the input image's Alpha channel.

Usage Scenarios

This node is highly useful in workflows involving image compositing or special effects creation. For example, you can first use this node to separate the red channel of an image, obtaining a grayscale image that highlights the red areas. This can then be fed into another image adjustment node to individually enhance or reduce the red component. Finally, it can be recombined with other channels to achieve precise color correction.

Notes

Please note that the input image must contain an Alpha channel (i.e., be in RGBA format); otherwise, errors may occur when processing the Alpha channel. The output red, green, and blue images, while in a three-channel format, have identical values for all three channels per pixel, essentially representing grayscale images with single-channel information.

The Split Image Channels node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…