Nodes/ComfyUI-WJNodes/Composite Mask
ComfyUI Node

Composite Mask

Pick what drives the blend, and what comes back out

By 807502278·Created 2 years ago·Updated 11 months ago· 21
Composite Mask
  • Options
  • Composite_Basic
use_maskauto
output_maskauto

Another entry in WJNodes' options-chain family for its ImageCompositeMask_adv compositor (Composite_Basic explains the chaining pattern, if this is your first stop). Composite_Mask handles two related but distinct questions: what mask actually controls the blend, and what mask the compositor hands you back afterward. They're independent settings, and it's worth treating them that way rather than assuming they mirror each other.

How it works

use_mask picks the source that drives blending:

  • auto - the compositor detects the best source automatically; the default.
  • none - no mask, blend the whole surface uniformly.
  • mask - use whatever's fed in as MaskMix elsewhere in the graph.
  • surface_alpha - use the surface image's own alpha channel as the mask.
  • back_alpha - use the background image's alpha channel instead.

That last two are genuinely handy if your surface or background already carries transparency (a cutout PNG, say) - you skip needing a separate mask input entirely and just point the compositor at the alpha that's already there.

output_mask is the separate question of what the compositor gives back as its own mask output, with more options than the input side: auto, none, white (a solid full mask), black (a solid empty one), mask (pass through MaskMix), surface_alpha, back_alpha, or mixed - a blend of the surface and background alpha channels via MaskMix. Useful when you want to chain the composite result into a further masked operation and need a mask that reflects the actual blend rather than reconstructing one from scratch.

The inputs and outputs that matter

  • use_mask (default auto) - the blend-mask source, from the list above.
  • output_mask (default auto) - what mask the compositor outputs, from the (longer) list above.
  • Options (optional) - the chain to extend.
  • Composite_Basic (output) - the updated chain.

Installing it

Via ComfyUI Manager: search ComfyUI-WJNodes, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/807502278/ComfyUI-WJNodes.git
cd ComfyUI-WJNodes
pip install -r requirements.txt

Nothing extra needed for this node.

Common issues & troubleshooting

Blend doesn't respect your alpha channel. Confirm use_mask is actually set to surface_alpha or back_alpha - auto makes a reasonable guess, but if it's guessing wrong for your particular graph, set the source explicitly rather than fighting the auto-detection.

Downstream node expecting a mask gets a blank or fully-white one. Check output_mask - none, white, and black are all legitimate settings for deliberately producing an empty or full mask, but they're also easy to leave set from an earlier test. If you need the mask to reflect the actual composited result, mixed is usually the setting that does that.

Mask output doesn't match what you fed in as use_mask. That's expected - these two settings are independent by design. Feeding mask into use_mask doesn't automatically make output_mask echo it back; set output_mask to mask explicitly if you want the same MaskMix value on both sides.

CategoryWJNode/ImageBlend/options

Inputs (3)

NameTypeDefaultDescription
use_maskCOMBOauto5 options: auto, none, mask, surface_alpha, back_alpha
output_maskCOMBOauto8 options: auto, none, white, black, mask, surface_alpha, +2
OptionsoptComposite_Basic

Outputs (1)

NameTypeDescription
Composite_BasicComposite_Basic