π§ Image Composite Masked
Paste an image anywhere β even fully off the canvas
- destination
- source
- mask
- IMAGE
Stock ComfyUI has ImageCompositeMasked, and it works - right up until you need the layer pushed partly off the edge of the canvas. The built-in clamps your x/y so the source can never leave the frame. The π§ Image Composite Masked node from ComfyUI-SuperNodes is a modified copy of that exact node where the clamp is gone: x and y go from -16384 to +16384, and whatever part of the source lands outside the destination simply gets cropped.
That one change turns it into the node you actually want for layer work. Put a re-rendered face back onto a background at a precise pixel offset. Slide a texture in from off-screen. Stitch a generated patch into a scene where the patch is bigger than the hole. Any "paste layer B onto canvas A" job where the math isn't conveniently centered - this is the reach-for.
How it works
The source image is copied onto the destination canvas at pixel offset (x, y). Negative x moves the source left (partially past the canvas edge), negative y moves it up - and the overhang is cropped rather than erroring out. You get three knobs beyond the offset:
- resize_source - scales the source to match the destination before compositing, if you want the layer to always cover the whole canvas.
- mask (optional) - white areas take the source pixels, black areas keep the destination. The mask is resized to the source's dimensions if they differ, so you don't have to match resolutions by hand.
- x / y - the offset, in pixels. At
0,0the source's top-left corner sits at the canvas origin, not the center; if you want it centered, compute(destination_width - source_width) / 2yourself.
Alpha is handled too - the node runs ComfyUI's alpha fix on both inputs before compositing, so an RGBA source pasted onto an opaque canvas behaves the way you'd expect instead of leaving a black box. The single output is the composited IMAGE, ready for a VAE decode or a Save node.
Installing it
It ships in the ComfyUI-SuperNodes pack by SuperCC (GitHub: sonnybox/ComfyUI-SuperNodes). The easy path is ComfyUI Manager:
- Manager β Install Custom Nodes and search for SuperNodes.
- Install, restart ComfyUI.
Or clone it manually:
cd ComfyUI/custom_nodes
git clone https://github.com/sonnybox/ComfyUI-SuperNodes
# restart ComfyUI
The only Python dependency is matplotlib, and these image nodes don't download any models. One real gotcha: the pack is written against ComfyUI's newer comfy_api extension interface, so on a stale ComfyUI install none of the SuperNodes will register at all. Update ComfyUI first if the node list comes up empty.
Where people get burned
If nothing appears on the canvas, the first suspect is your offset, not the node - the source can now move fully off-canvas and just vanish. Negative offsets are the whole point of this fork, but they're also the easiest way to paste onto nothing. And remember the mask semantics: white = paste the source, black = keep the destination. Flip it the wrong way and your "composite" quietly deletes the thing you were pasting.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| destination | IMAGE | The canvas the source is pasted onto. | |
| source | IMAGE | The layer to paste onto the destination. | |
| x | INT | 0-16384β16384 | Horizontal offset in pixels. Negative moves the source left past the canvas edge. |
| y | INT | 0-16384β16384 | Vertical offset in pixels. Negative moves the source up past the canvas edge. |
| resize_source | BOOLEAN | false | Resize the source to match the destination before compositing. |
| maskopt | MASK | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | β |