Nodes/ComfyUI S4Tool Image/💀Image Blend With Alpha
ComfyUI Node

💀Image Blend With Alpha

Stamp a mask onto an image and get a real RGBA cutout

By S4MUEL-404·Created about a year ago·Updated 9 months ago· 4
💀Image Blend With Alpha
  • image
  • alpha
  • image_with_alpha
mask_modemask

You have an image and a mask. You want an actual cutout - an image whose pixels carry that mask as their alpha channel, so you can save a real transparent PNG. That's a two-step annoyance in a lot of workflows, and 💀Image Blend With Alpha is the node that collapses it into one. It's from the S4Tool-Image pack, and the author's own docstring says it plainly: it "mimics the behavior of JoinImageWithAlpha."

The mechanism is simple and worth knowing. The node takes your IMAGE and your MASK, crops the image down to the opaque region of the mask (so you don't haul a sea of transparent pixels around), and merges the mask in as the alpha channel of an RGBA image. The result is a true cutout tensor, not a black-background composite or a mask that you'd have to manually apply later. If you've used other ComfyUI packs, this is the same operation as JoinImageWithAlpha from WAS, just rebadged and living in the 💀S4Tool category.

Inputs and output

  • image - the IMAGE whose pixels you're keeping.
  • alpha - a MASK. This becomes the transparency. White areas of the mask stay opaque; black areas vanish.
  • mask_mode - mask or invert mask. The invert option flips the mask before applying, which is your shortcut when the mask you have is "keep everything except X."

One output: image_with_alpha (an IMAGE in RGBA). Wire it into a Save Image / PNG output, a compositor, or anything that accepts RGBA.

The crop-to-opaque behavior is the part people either love or get surprised by: if your mask only covers part of the image, the output is smaller than the input - the transparent borders are trimmed. For most cutout use that's a feature (a tight PNG instead of a padded one). If you need the canvas size preserved, you'll want to pad it back after, or reach for a straight composite node instead.

Install

It ships with the S4Tool-Image pack, so:

cd ComfyUI/custom_nodes/
git clone https://github.com/S4MUEL-404/ComfyUI-S4Tool-Image.git
pip install -r ComfyUI-S4Tool-Image/requirements.txt

Or via ComfyUI Manager: search "S4Tool-Image" → Install → restart.

No model downloads here - this node is pure Pillow/numpy, so it's one of the safe, fast ones in the pack.

Gotchas

  • Output smaller than input - that's the intended crop-to-opaque behavior, not a bug.
  • Everything transparent / everything opaque - check your mask_mode. If the mask semantics feel backwards, invert mask is the one-word fix.
  • Masked-out areas are gone, not black - the pixels are dropped, not filled with a color. If you need a colored background behind the cutout, composite this output over a solid image (the pack's 💀Image Color is handy for that).

That pairing - 💀Image Color as a background plus this node's cutout over it - is a surprisingly common little workflow, and it's why these two nodes sit together in the same pack.

Category💀S4Tool

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
alphaMASK
mask_modeCOMBOmask2 options: mask, invert mask

Outputs (1)

NameTypeDescription
image_with_alphaIMAGE