Alpha Composite
Layer-style compositing with offsets, blur, and scale
- background
- foreground
- background_mask
- foreground_mask
- image
- mask
Fun fact about this pack: the README only documents two nodes, but the source ships four, and Alpha Composite is the one nobody told you about. It's a general-purpose layer compositor - think "photoshop layer stack inside your graph" - that takes a foreground, a background, and blends them with independent offsets, scaling, blur, and opacity. It's not strictly part of the crop-and-paste story, but it's the glue you reach for when you want a soft-edged element placed over an image without opening a raster editor.
Why you'd want it in a workflow: detail stitching is all about controlled placement, and sometimes the controlled part isn't a crop box but a composited layer - a watermark, a corrected face region, a foreground object feathered into a scene. This node does the Porter-Duff "over" composite (foreground over background, alpha-aware) that ComfyUI's core nodes oddly make you hand-assemble.
How it works
It splits each input into RGB plus an alpha channel - either from the image's own alpha (if it's already RGBA) or from an optional background_mask / foreground_mask you feed in. Then, in order: the foreground is scaled (fg_scale, 0–10, 1 = no scaling), both layers get a separable Gaussian blur applied to their color and alpha (so edges feather into transparency rather than cutting off), opacity is multiplied in, and both are placed onto a canvas sized to the background using bg_offset_x/y and fg_offset_x/y (each ±8192). Finally the "over" operation combines them.
The inputs that matter most for a beginner:
- background and foreground - the two images.
- fg_scale - resize the foreground without touching the background.
- fg_blur / bg_blur - 0–200, feather the layer edges. Small values (2–8) hide seams; big values give a soft glow look.
- fg_opacity / bg_opacity - 0 to 1, exactly what they sound like.
- fg_offset_x / fg_offset_y - nudge the foreground around the canvas.
Outputs are image and mask. One honest warning: the image output is 4-channel RGBA, not the 3-channel IMAGE most ComfyUI nodes expect. Either split the alpha back off before wiring downstream, or use the mask output for anything that needs a mask.
Installing it
Same pack as everything else here - ComfyUI Manager (search Detail Stitch) or:
cd ComfyUI/custom_nodes
git clone https://github.com/mancusog/comfyui-detail-stitch.git
Restart and it appears under the "Detail Stitch" category. No requirements file, no models, just torch.
Where people get burned
- The 4-channel output surprise. You'll get a "size mismatch" or a black-ish image somewhere downstream if you don't account for the alpha. Split it or feed nodes that accept RGBA.
- Blur before placement. The blur runs before offsetting, so a blurred edge doesn't smear across the offset - which is right, but if you expected a Photoshop-style drop shadow, this isn't it.
- No documentation. Since the README never mentions this node, the only ground truth is the code. The defaults are sane (everything starts neutral), so start there and adjust.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| background | IMAGE | — | |
| foreground | IMAGE | — | |
| bg_offset_x | INT | 0-8192–8192 | — |
| bg_offset_y | INT | 0-8192–8192 | — |
| bg_blur | FLOAT | 0.00–200 | — |
| bg_opacity | FLOAT | 1.000–1 | — |
| fg_offset_x | INT | 0-8192–8192 | — |
| fg_offset_y | INT | 0-8192–8192 | — |
| fg_scale | FLOAT | 1.000–10 | — |
| fg_blur | FLOAT | 0.00–200 | — |
| fg_opacity | FLOAT | 1.000–1 | — |
| background_maskopt | MASK | — | |
| foreground_maskopt | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |