Nodes/ComfyUI-Apt_Preset/type_ImageAlphaSplit
ComfyUI Node

type_ImageAlphaSplit

Split RGBA images into RGB + a transparency mask

By cardenluo·Created 2 years ago·Updated 22 days ago· 309
type_ImageAlphaSplit
  • images
  • images
  • masks

An RGBA image (PNG with transparency) shows up in ComfyUI as a 4-channel tensor, and then half your nodes refuse to touch it because they want 3-channel RGB. type_ImageAlphaSplit fixes that in one step: it takes a list of images, strips the alpha channel into a proper MASK, and hands you both - the RGB image for your pipeline and the transparency as a mask for compositing, inpainting, or anything mask-shaped.

It's from the data drawer of ComfyUI-Apt_Preset. If you've ever loaded a transparent PNG and watched a VAE or a blend node explode, this is the node you were missing.

How it works

It expects its images input as a list (it's declared INPUT_IS_LIST), and it processes each image:

  • 4-channel input - channels 1–3 become the RGB image, channel 4 becomes the alpha mask. Two clean outputs per input, one RGB, one mask.
  • 3-channel input - passes through as-is, with an all-zeros (fully opaque) mask so the outputs stay aligned.
  • Anything else (1-channel, 2-channel) - raises a clear error listing which channel counts it accepts (3 or 4).

Both outputs are lists too (images as a list of RGB images, masks as a list of masks), so the pairing is preserved one-to-one: the Nth image and Nth mask came from the same source. That alignment is the whole point - no separate "which mask goes with which image" bookkeeping.

Inputs and outputs

  • images - list of IMAGE tensors.
  • Outputs: images (RGB, list) and masks (MASK, list).

Wire the RGB output into your main pipeline (sampler, VAE decode, save) and the mask into anything that takes a mask - a compositing node, an inpaint area, or a background swap. Classic use: cutout work where you load an RGBA sprite, split it, and use the alpha both as a mask and as a guide for other operations.

Installing it

Part of ComfyUI-Apt_Preset. ComfyUI Manager → search ComfyUI-Apt_Preset, or:

cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset

Restart; install.bat on Windows for the pack's requirements. Nothing extra for this node.

Common issues

The main gotcha is that it wants a list input, not a single image - feed it a plain IMAGE tensor and the wiring may not connect or behave as expected; route it through a node that produces a list first (the pack's type_Image_Batch2List or any list-output node). If you feed it an already-RGB image you get a valid-but-empty mask, which is fine unless you assumed the mask was real transparency. And the output lists are index-aligned - reorder or drop items downstream and the pairing silently breaks. Keep the pipeline one-to-one and it never surprises you.

CategoryApt_Preset/data

Inputs (1)

NameTypeDefaultDescription
imagesIMAGE

Outputs (2)

NameTypeDescription
imagesIMAGE
masksMASK