ComfyUI Node

Alpha Composite

Alpha Composite

By antrobot1234·Created 3 years ago·Updated about a year ago· 28
Alpha Composite
  • image_source
  • image_dest
  • mask_source
  • mask_dest
  • image_out
x_offset0
y_offset0

composite layers one image over another at an x/y offset, using masks as alpha channels. Think of it as the "paste this on top of that, here" node - a straightforward overlay with transparency, no resizing, no fitting-into-a-region logic. If you want Photoshop's "paste and nudge into position," this is it in a single node.

Why you'd reach for it

Plenty of small compositing jobs don't need anything clever: dropping a foreground subject onto a new background, stamping a watermark or logo, layering a generated element onto a plate. composite covers those with two images and an offset. Both masks are optional, so it degrades gracefully - leave a mask off and that image just gets pasted as-is (fully opaque). That makes it the low-ceremony choice when you don't have or don't need an alpha for one side.

Its sibling Paste with Masks is the one to use when the source needs to be cropped or resized to fit a target region. composite deliberately doesn't do that - it places the source at an offset and blends. Simpler tool, fewer surprises.

How it works

It pastes image_source onto image_dest shifted by x_offset and y_offset, treating mask_source and mask_dest as alpha channels where provided. White in a mask means opaque, black means transparent. If a mask is missing, that image is composited as-is with no transparency.

The inputs that matter

  • image_source / image_dest - the top layer and the bottom layer. Source goes over dest.
  • x_offset / y_offset (optional) - where the source lands, in pixels. These accept negatives, so you can nudge the source off any edge; both default to 0 (top-left).
  • mask_source (optional) - alpha for the source. This is the one you'll usually want, since it's what makes the overlay actually cut out rather than paste a rectangle.
  • mask_dest (optional) - alpha for the destination, if you need the bottom layer to be partly transparent too.

Output is a single image_out.

Installing it

ComfyUI Manager → search antrobots ComfyUI Nodepack, install, restart. Or clone:

cd ComfyUI/custom_nodes
git clone https://github.com/antrobot1234/antrobots-comfyUI-nodepack

No models, no dependencies to fetch - it's a pixel operation.

Common issues

The most common surprise is forgetting mask_source and getting a full opaque rectangle pasted over your background. If your "cutout" isn't cutting out, that's why - supply a source mask so the transparent areas actually read as transparent.

Second, alignment. The offsets place the source's top-left corner, not its center, so a subject can end up shifted from where you pictured it. If you need pixel-precise placement, feed the offsets from a math or size node (this pack's Get Image Size pairs well here) rather than eyeballing them.

Finally, if the source is a different size than the destination and it's getting clipped at an edge, that's expected - composite doesn't resize. Use Paste with Masks or scale the source first if you need it to fit.

Categoryantrobots-ComfyUI-nodepack/image-handling

Inputs (6)

NameTypeDefaultDescription
image_sourceIMAGE
image_destIMAGE
mask_sourceoptMASK
mask_destoptMASK
x_offsetoptINT0-9223372036854776000–9223372036854776000
y_offsetoptINT0-9223372036854776000–9223372036854776000

Outputs (1)

NameTypeDescription
image_outIMAGE