Layer Stack Composite
Base image plus up to four masked layers, blended in order
- base_image
- layer_1
- layer_1_mask
- layer_2
- layer_2_mask
- layer_3
- layer_3_mask
- layer_4
- layer_4_mask
- image
- combined_mask
- layer_info
Every serious ComfyUI workflow eventually needs to combine images the way a compositor would: a background, a subject on top, a light-wrap layer over that, a vignette to finish. Doing that with a pile of blend nodes gets ugly fast. MKRLayerStackComposite is the pack's "layers panel": one node that stacks a base image plus up to four extra layers, each with its own mask, opacity, and blend mode, composited top to bottom. If you've ever wished a Comfy graph had a layers palette, this is as close as it gets.
How it works
You provide base_image and a layer_1 (required), then optionally layers 2 through 4. Each layer composites over whatever has been built so far, in order: layer 1 first, then 2, 3, 4 - so layer 4 ends up on top. Per layer you set:
opacity- how much of it shows through (0 to 1).blend_mode- eight options:normal,screen,multiply,overlay,soft_light,add,lighten,darken. Screen/add for light and glows, multiply for shading and texture, overlay for punch - the usual suspects.- an optional
mask- aMASKtensor controlling where the layer shows.
The resize behavior is set once via resize_mode: stretch fits each layer to the canvas (distorting aspect), contain fits it inside (letterboxing), cover fills the canvas (cropping overflow). One setting applies to all layers, which is simpler than per-layer - and usually fine, since layers usually share a canvas.
The mask handling is where the pack's thoughtfulness shows. If a layer image carries an alpha channel, that alpha is used automatically. If you also connect a mask, the mask is multiplied with the layer's own alpha - so you get "this subject, only visible where my mask says." And mask_feather softens mask edges across the whole stack in one knob, which is the difference between a hard cutout and a comp that sits in the image.
Outputs
image- the composited result.combined_mask- the union of every layer's visible contribution, as aMASK. Wire this into anything that needs to know where the stacked layers actually cover the frame - a detailer, a save-time matte, or a follow-up pass that should only touch composited regions.layer_info- a string describing what got applied ("Layer 1: mode=screen, opacity=0.80 | ..."). Feed it to a text display for a quick audit.
Installing it
Part of the pack:
# ComfyUI Manager: search "MKRShift Nodes", install, restart.
# or:
cd ComfyUI/custom_nodes
git clone https://github.com/criskb/MKRShift_Nodes
# restart ComfyUI
No extra dependencies, no models.
The honest take
This is a solid, unglamorous workhorse - the kind of node that quietly sits in the middle of comp-heavy graphs. Two things to know before you lean on it. First, the blend math is straightforward PIL/numpy territory: don't expect ACES-linear compositing or OCIO color management. If you're doing VFX that needs to hand off to Nuke or a color pipeline, you still want to manage color space yourself - this node blends in whatever space its inputs are in. Second, it's bottom-up ordered, so if you wire layer 3 and expect it to appear behind layer 1, you need to think about order before you connect. Stack order is the one thing you can't adjust after the fact without rewiring. For masking-driven compositing inside a generation pipeline - subject onto background, glow over subject, vignette on top - it beats a tower of blend nodes every time.
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| base_image | IMAGE | — | |
| layer_1 | IMAGE | — | |
| layer_1_opacity | FLOAT | 1.000–1 | — |
| layer_1_blend_mode | COMBO | normal | 8 options: normal, screen, multiply, overlay, soft_light, add, +2 |
| resize_mode | COMBO | stretch | 3 options: stretch, contain, cover |
| layer_1_maskopt | MASK | — | |
| layer_2opt | IMAGE | — | |
| layer_2_maskopt | MASK | — | |
| layer_2_opacityopt | FLOAT | 1.000–1 | — |
| layer_2_blend_modeopt | COMBO | normal | 8 options: normal, screen, multiply, overlay, soft_light, add, +2 |
| layer_3opt | IMAGE | — | |
| layer_3_maskopt | MASK | — | |
| layer_3_opacityopt | FLOAT | 1.000–1 | — |
| layer_3_blend_modeopt | COMBO | normal | 8 options: normal, screen, multiply, overlay, soft_light, add, +2 |
| layer_4opt | IMAGE | — | |
| layer_4_maskopt | MASK | — | |
| layer_4_opacityopt | FLOAT | 1.000–1 | — |
| layer_4_blend_modeopt | COMBO | normal | 8 options: normal, screen, multiply, overlay, soft_light, add, +2 |
| mask_featheropt | FLOAT | 0.00–128 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| combined_mask | MASK | — |
| layer_info | STRING | — |