Nodes/HommageTools for ComfyUI/HT Layer Collector
ComfyUI Node

HT Layer Collector

Build a real PSD layer stack inside your graph

By ArtHommage·Created 2 years ago·Updated about a year ago· 4
HT Layer Collector
  • image
  • mask
  • input_stack
  • layer_stack
layer_nameLayer

Every compositing workflow hits the same wall: you've generated a background, a subject, and some effects as separate images, and ComfyUI's default save flattens them all into one PNG. Then you have to rebuild the layers by hand in an editor. HT Layer Collector is the first half of the fix - it's the node that accumulates images into a LAYER_STACK, each one a named layer with optional transparency, so the whole composition can be exported as an actual layered file. Pair it with HT Layer Export and the separation survives.

What it does

You feed it an image, give it a layer_name (default "Layer"), and it pushes that image onto a stack. The two optional inputs are where it gets interesting:

  • mask - if you provide one, it becomes the layer's alpha channel. A transparent-background subject (say, a masked character render) stays transparent in the stack instead of arriving as an opaque rectangle.
  • input_stack - this is how you chain collectors. You wire the layer_stack output of one collector into the input_stack of the next, and each one appends its image on top. Background collector first, subject second, effects third - the order you connect them is the order they stack.

The output is the same layer_stack type all the way down, and it only becomes a file when you hand it to an export node.

The workflow shape

The README's own example is the clearest:

HTLayerCollectorNode (Background) → HTLayerCollectorNode (Subject) → HTLayerExportNode → PSD File

For that to be useful, each layer's image needs to already be sized and aligned - the collector doesn't position or resize anything, it just records what you give it. If your subject came out of an inpainting or mask-crop pass at a different size, normalize it first (HT Smart Resize is right there in the same pack). Layer order in the exported file follows the chain order, not alphabetical.

How it works

Under the hood it's a small data structure: each entry holds the image tensor, the mask-as-alpha if present, and the layer name. It does the BHWC normalization the rest of the pack is careful about, and it stores metadata so the export step knows the layer names and where transparency lives. Nothing touches disk - this is pure in-memory stack building, so it costs nothing to have several of them in a graph.

Installing

Standard pack install - Manager → "HommageTools for ComfyUI", or:

cd ComfyUI/custom_nodes
git clone https://github.com/ArtHommage/HommageTools.git
cd HommageTools && pip install -r requirements.txt

restart. No model files, no heavy dependencies beyond the pack's own requirements (the export node is the one that needs psd-tools and tifffile, which the requirements.txt already covers).

The honest take

This is a genuinely useful idea, and it's also a niche one - you'll reach for it when your workflow is doing serious multi-layer compositing (character + background + effects separated by masks) and you want the editable file to look like the work you actually did. If you mostly flatten and move on, the collector is a step you don't need. One thing to watch: it's a custom type (LAYER_STACK), so nothing else in ComfyUI understands it - the stack only has value inside this pack's collector/export pair, and given the "perpetually in alpha" disclaimer, don't treat the stack data as a long-term storage format.

CategoryHommageTools/Layers

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
layer_nameSTRINGLayer
maskoptMASK
input_stackoptLAYER_STACK

Outputs (1)

NameTypeDescription
layer_stackLAYER_STACK