Nodes/ComfyUI-JH-PixelPro/Compositing: Layer Group (nest)
ComfyUI Node

Compositing: Layer Group (nest)

Fold a whole layer stack into one parent layer

By jetthuangai·Created 5 months ago·Updated 4 months ago· 5
Compositing: Layer Group (nest)
  • parent_stack
  • sub_stack
  • group_mask
  • LAYER_STACK
group_blend_modenormal
group_opacity1.00

Photoshop's layer groups exist for one reason: you built a set of layers that function as a unit, and you want to treat them as a unit - move them together, mask them together, apply one opacity to the whole bundle. JHPixelProLayerGroup is the pack's version of that. It takes two stacks - a parent_stack and a sub_stack - and collapses the sub-stack into a single grouped parent layer on top of the parent stack, with its own blend mode, opacity, and optional mask.

Mechanically it's simple: the sub-stack is flattened internally into one composite, then that composite is treated as one layer with group_blend_mode and group_opacity applied, and a group_mask (optional) gating it. The output is a new LAYER_STACK - one layer richer than the parent you fed in, with the entire sub-stack folded into it.

When you actually want this

The obvious case is organization: build a five-layer cinematic grade as its own stack, then group it so it behaves like a single adjustment unit in a bigger composition. But there are two less-obvious wins.

First, group opacity vs. layer opacity. In Photoshop, dropping a group's opacity to 50% affects the merged result differently than dropping each layer to 50% - the group blends internally first, then fades. group_opacity gives you that exact behavior, which is subtly but genuinely different from turning down individual layers. If you've ever fought to get a "fade the whole effect" look with per-layer opacity and failed, this is the knob.

Second, group masking. A group_mask applies to the whole sub-stack at once - mask five adjustment layers' combined effect with one mask, instead of multiplying five masks together by hand. That's a real time-saver in composite-heavy work.

Inputs and output

  • parent_stack: the stack you're adding to.
  • sub_stack: the stack being folded into one layer.
  • group_blend_mode: 27 modes, same list as JHPixelProLayerAdd (normal, multiply, screen, overlay, …).
  • group_opacity (0–1, default 1): opacity of the merged group.
  • group_mask (optional): gates the whole group.

Output is the combined LAYER_STACK. Same immutability rules as the rest of the system - new stack out, nothing mutated.

Install

ComfyUI Manager → search ComfyUI-JH-PixelPro, or:

cd ComfyUI/custom_nodes
git clone https://github.com/jetthuangai/ComfyUI-JH-PixelPro.git
cd ComfyUI-JH-PixelPro
pip install -r requirements.txt

Restart ComfyUI; it's under ComfyUI-JH-PixelPro/compositing. The pack needs ComfyUI ≥ 0.43.x, Python ≥ 3.10, plus kornia, mediapipe, opencv-python-headless, and scipy.

Honest take: this is the node you'll skip for the first few compositions and then discover you need. The layered system works fine without it - Start, a few Adds, Flatten. But the moment you want to treat "the whole cinematic grade" as a single reusable unit inside another composite, or fade an entire effect bundle at once, you'll go looking for exactly this and be glad it's there. It's the "nest" in the display name, and nesting is what turns a flat layer list into an actual compositing system. One caveat: like the rest of the pack's compositing group, there are no layer styles (no drop shadow, no glow) - a group here is about structure, blend, and masking, not decorative effects.

CategoryComfyUI-JH-PixelPro/compositing

Inputs (5)

NameTypeDefaultDescription
parent_stackLAYER_STACK
sub_stackLAYER_STACK
group_blend_modeCOMBOnormal27 options: normal, dissolve, darken, multiply, color_burn, linear_burn, +21
group_opacityFLOAT1.000–1
group_maskoptMASK

Outputs (1)

NameTypeDescription
LAYER_STACKLAYER_STACK