Image Composite Masked
A compositor you can flip off without rewiring
- destination
- source
- mask
- IMAGE
This is ComfyUI's stock ImageCompositeMasked with exactly one thing added: an enabled boolean. Turn it off and the node returns destination untouched, as if it weren't in the graph at all. That's the whole pitch, and it's a genuinely useful one once you've built more than a couple of A/B branches into a workflow.
What it's actually for
ImageCompositeMasked is the node behind the single most important inpainting discipline in ComfyUI: never let a VAE encode/decode cycle touch pixels outside your edit region. You inpaint or process a masked area, then paste just that region back onto the untouched original with ImageCompositeMasked - the rest of the image never goes anywhere near the VAE, so it can't pick up the color shift or softness that a full-image round-trip causes. It's a load-bearing node in a lot of face-fix, region-edit, and outpaint pipelines.
The problem it doesn't solve on its own is testing. If you want to compare "with compositing" against "without" - or leave a compositing step in a shared workflow but let people disable it per-run - the stock node gives you no way to do that short of physically rewiring the graph or reaching for a bypass tool. zhangp365's pack leans hard into a different answer: give individual nodes their own on/off switch, node-local, so a checkbox does what a graph-wide bypass dashboard (the kind rgthree-comfy's Fast Groups Bypasser gives you at the group level) does at the single-node level.
Inputs and outputs
destination/source- the base image and the image being pasted in.x/y- wheresource's top-left corner lands ondestination(0–16384).mask(optional) - which pixels ofsourceactually get pasted; without one, the wholesourcerectangle pastes.invert_mask- flips which side of the mask counts as "paste here."resize_source- ifsourcedoesn't matchdestination's size, resize it to fit before pasting.enabled- the addition. Off, anddestinationcomes straight through, ignoring everything else.
One output: IMAGE, ready to go straight into SaveImage, a preview, or further down the graph.
Installing it
Through ComfyUI Manager (search "ComfyUI-utils-nodes"), or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/zhangp365/ComfyUI-utils-nodes
Restart ComfyUI. Nothing to configure at the dependency level - it's a straight extension of core ComfyUI image ops.
Common trip-ups
Most of the issues here are the same ones the stock ImageCompositeMasked has, since the compositing logic itself is untouched: get x/y wrong and your paste lands in the wrong place rather than erroring, since the node will happily composite off-target as long as it's within bounds. If resize_source is off and source and destination don't match in size, expect a shape-mismatch error rather than a silent stretch. The switch-specific gotcha is just remembering it exists: if you flip enabled off to debug something and forget to flip it back, you'll be staring at an uncomposited output wondering why your edit isn't showing up - check that checkbox first before you go hunting for a mask or coordinate bug.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| destination | IMAGE | — | |
| source | IMAGE | — | |
| x | INT | 00–16384 | — |
| y | INT | 00–16384 | — |
| resize_source | BOOLEAN | false | — |
| enabled | BOOLEAN | true | — |
| invert_mask | BOOLEAN | false | — |
| maskopt | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |