Nodes/comfyui-mixlab-nodes/TransparentImage ♾️Mixlab
ComfyUI Node Runs on cloud

TransparentImage ♾️Mixlab

Turn an image plus a mask into a saved RGBA cutout

By MixLabPro·Created 3 years ago·Updated 2 months ago· 1,859
TransparentImage ♾️Mixlab
  • images
  • masks
  • file_path
  • IMAGE
  • RGBA
invert
save
filename_prefixMixlab_save

TransparentImage is the "apply this mask as transparency" node - the manual sibling to the pack's automatic RembgNode_Mix. Where RembgNode_Mix computes its own segmentation mask internally and cuts out whatever it decides is the subject, TransparentImage takes a mask you already have - from EditMask's hand-painted brush, from SAM, from RembgNode_Mix itself, from anywhere - and applies it to an image as an alpha channel, optionally writing the result straight to disk. It's the node behind the README's own TransparentImage screenshot: a general-purpose way to turn "I have an image and a mask" into a real transparent PNG.

The required fields are images and masks, the pair you're combining, plus two enum toggles: invert (yes/no), which flips whether the masked region or its inverse becomes transparent - useful if your mask was drawn around the part you want to keep rather than the part you want gone - and save (yes/no), which controls whether the node writes files to disk in addition to passing data downstream. If you turn save on, the optional filename_prefix (default Mixlab_save) sets the naming, matching the pattern of ComfyUI's own SaveImage node.

Three outputs come back, all as lists so batches work naturally: IMAGE (the cutout, still as a standard image type, useful if the next node in your graph doesn't need the RGBA distinction), RGBA (the same cutout as Mixlab's proper RGBA type, for feeding its layer nodes), and file_path (the path each saved file landed at, when save was on - empty or irrelevant if you didn't save).

Where this differs from reaching for a dedicated background-removal model: this node does no segmentation of its own. It's exactly as good as the mask you feed it. A clean, well-fit mask gives a clean cutout; a rough or hard-edged one gives a rough or hard-edged cutout, because the transparency here is a direct application of whatever alpha values the mask contains. If your mask came from a plain segmentation model rather than a matting-aware one, expect the same limitation background-removal models generally have - fine hair, semi-transparent material, and complex edges won't magically look better just because this node applied them; feed it a mask with soft, fractional edges (run it through Smooth Mask or Feathered Mask first, or use a matting model upstream) if a hard-cutout look isn't what you want.

Install is the pack-wide standard:

cd ComfyUI/custom_nodes
git clone https://github.com/shadowcz007/comfyui-mixlab-nodes.git
cd comfyui-mixlab-nodes
install.bat

or via ComfyUI Manager (search "comfyui-mixlab-nodes"), or pip3 install -r requirements.txt in a venv. No model download needed - it's compositing math applied to a mask you supply, not an inference step.

The most common surprise is a cutout that grabbed the wrong region - check invert first, since a mask drawn around your subject and a mask drawn around the background produce opposite results through this node, and it's an easy toggle to have backwards. If save was on but you can't find a file, check ComfyUI's normal output directory rather than somewhere custom - like most of the pack's save-capable nodes, this one uses a filename prefix, not a full path field. And if the edges of your cutout look harsher than expected even though you fed it a soft-looking mask, double check the mask genuinely carries fractional alpha values rather than being a hard black-and-white mask that only looks soft at a glance - a true hard mask through this node produces a hard cutout, full stop, regardless of how it renders in a small preview thumbnail.

Category♾️Mixlab/Image

Inputs (5)

NameTypeDefaultDescription
imagesIMAGE
masksMASK
invertCOMBO2 options: yes, no
saveCOMBO2 options: yes, no
filename_prefixoptSTRINGMixlab_save

Outputs (3)

NameTypeDescription
file_pathSTRING
IMAGEIMAGE
RGBARGBA