Nodes/comfyui-art-venture/Image Extract Channel
ComfyUI Node Runs on cloud

Image Extract Channel

Pull one R/G/B/A channel as a mask

By sipherxyz·Created 3 years ago·Updated 4 months ago· 352
Image Extract Channel
  • images
  • channel_data
channel

An image is really four grayscale layers stacked together - red, green, blue, and sometimes alpha. This node lets you pull out any one of them on its own and hand it back as a mask. Small tool, but it quietly solves a bunch of masking problems that otherwise need a detour.

The one people hit most: grabbing the alpha channel as a mask. You ran a background remover and got an RGBA image with transparency baked into the alpha. To actually use that transparency - to composite, to inpaint the subject, to drive a paste - you need it as a mask. Extract the A channel and there it is. The color channels are handy too: pull R, G, or B when a specific channel happens to isolate what you want, which comes up with certain maps, depth passes, and images where one color carries the signal.

How it works

It reads the image and returns the single channel you pick as a MASK - a one-channel grayscale field where each pixel's value is that channel's intensity. No thresholding, no inversion, just the raw channel lifted out. From there it flows into anything that takes a mask: inpainting, compositing, ControlNet, a mask preview.

Inputs and outputs

Two required inputs:

  • images - the source IMAGE to pull a channel from.
  • channel - which one: R, G, B, or A. Alpha (A) is the common pick when you're after transparency; the rest are for when a color channel isolates your subject.

The output is channel_data, typed as MASK - straight into a mask input downstream.

Installing it

Part of the ArtVenture pack. ComfyUI Manager: search comfyui-art-venture, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/sipherxyz/comfyui-art-venture

Restart ComfyUI. No downloads.

Common issues

Extracting A gives you nothing (or a solid white mask). Your image has no real alpha channel. Plenty of images are RGB-only, and asking for a channel that isn't there gives you a flat result. Make sure the upstream step actually produced transparency - and note that some loaders and nodes silently drop the alpha channel, so a cutout can lose its transparency before it ever reaches this node. If your background remover has a "keep alpha" option, turn it on.

The mask is inverted from what you want. A channel comes out as-is; the node doesn't flip it. If your downstream node treats white as "masked" and you need the opposite, drop an invert-mask node after this one.

You picked the wrong channel. For plain transparency you almost always want A, not a color channel. The R/G/B options are situational - reach for them only when you know a specific color channel isolates your subject, otherwise A is the one.

It's grayscale, and you expected color. That's correct - a mask is single-channel by definition. If you wanted the channel visualized as an image, convert the mask back to an image downstream; this node's job is to produce a mask.

CategoryArtVenture/Utils

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
channelCOMBO4 options: R, G, B, A

Outputs (1)

NameTypeDescription
channel_dataMASK