Nodes/ComfyUI-JH-PixelPro/Compositing: Layer Stack Start
ComfyUI Node

Compositing: Layer Stack Start

Photoshop-style layers in ComfyUI start here

By jetthuangai·Created 5 months ago·Updated 4 months ago· 5
Compositing: Layer Stack Start
  • background
  • LAYER_STACK

Every Photoshop document starts with a background layer. JHPixelProLayerStackStart is that background layer for ComfyUI - it takes a single IMAGE and turns it into a LAYER_STACK, the pack's custom pass-through type that lets you build Photoshop-style layered compositions entirely in the graph.

It does exactly one thing, so don't overthink it: background IMAGE in, LAYER_STACK out. The stack it creates is the base everything else stacks on top of, and it defines the canvas size for the whole composition - the pack's docs note that masks and layer images added later get auto-resized to the base stack size (bilinear interpolation), so this node effectively sets your composite's dimensions. If you want a 1024×1024 final comp, the background you feed here should be 1024×1024.

Why a "stack" and not just an image

The important part isn't the node - it's the type. A LAYER_STACK is an immutable list of layers: each node that operates on it (JHPixelProLayerAdd, JHPixelProLayerGroup) returns a new stack rather than mutating the old one. That's deliberate design and it matters for two reasons. First, it keeps the graph functional - you can branch off the same stack into two different compositions without one path corrupting the other. Second, nothing is actually composited until you run JHPixelProLayerFlatten, which is the node that finally renders the stack back into a real IMAGE. Between Start and Flatten you're just building a description of layers.

So the minimal realistic workflow is: JHPixelProLayerStackStart → one or more JHPixelProLayerAdd (each adding an image with a blend mode and opacity) → JHPixelProLayerFlatten → preview. That's a Photoshop document with a background and some layers, minus the panel.

The gotchas

Because the type is immutable and stack-shaped, a couple of failure modes are worth knowing. An empty stack can't be flattened - JHPixelProLayerFlatten raises a ValueError, which mostly means "you disconnected something upstream." And you can't just feed a LAYER_STACK into a normal IMAGE consumer; you must flatten it first. If a node downstream refuses your wire, that's why.

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: on its own this node is trivial - an IMAGE-to-stack converter - and it deserves no ceremony. Its entire value is that it unlocks the pack's layer compositing system, which is the closest thing ComfyUI has to non-destructive layered editing. If you've ever rebuilt a multiply blend by hand with a chain of math nodes and wished it were a layer, this is the entry point. Start here, add a couple of layers, flatten, and you've got a compositing pipeline that behaves like the tool everyone learned retouching on.

CategoryComfyUI-JH-PixelPro/compositing

Inputs (1)

NameTypeDefaultDescription
backgroundIMAGE

Outputs (1)

NameTypeDescription
LAYER_STACKLAYER_STACK