ComfyUI Node

Batch to PSD

Turn a rendered batch into a real multi-layer PSD

By dseditor·Created about a year ago·Updated 7 months ago· 75
Batch to PSD
  • images
  • message
filename_prefixComfyUI_PSD
reverse_layer_orderfalse

If you've ever wanted to composite AI-generated layers in Photoshop instead of wrestling masks in ComfyUI, BatchToPSD is the handoff you're missing. It takes a batch of images and writes them out as a single multi-layer .psd file, transparency included, straight into your ComfyUI output folder. It was clearly built for a specific workflow - layer-stack pipelines where you render a "merged" preview plus individual element layers - and it nails that use case with almost no setup.

How it works

The node assumes your batch is ordered: the first image is the merged preview and gets skipped, and everything after it becomes a layer. So a batch of 5 images produces a PSD with 4 layers named Layer_1Layer_4. It converts each tensor to a PIL image, checks every layer for an alpha channel, and if any layer has transparency it creates the PSD in RGBA mode so the transparency survives - a fix the code's own comments call out as critical, because writing RGBA layers into an RGB-mode PSD silently flattens them.

Output file naming is {filename_prefix}_{timestamp}.psd in your output directory, so you never overwrite a previous export. reverse_layer_order flips the stacking order bottom-to-top if your pipeline renders in the opposite order.

Inputs and output

  • images - the batch. Must have at least 2 images, or it returns a clear error (first is skipped, the rest become layers).
  • filename_prefix - the output name prefix, default ComfyUI_PSD.
  • reverse_layer_order - optional stacking flip.

The output is a message string with the saved file path - plug it into a Show Text node so you can click through to the result. It's an output node, so it'll sit at the end of the branch.

Installing it

cd ComfyUI/custom_nodes
git clone https://github.com/dseditor/ComfyUI-ListHelper

On first use the node auto-installs psd-tools via pip and then tells you to restart ComfyUI - the README and the code both insist on this, and it's the step people skip. If auto-install fails (or you'd rather do it yourself):

pip install psd-tools

Restart and run again. ComfyUI Manager: search "ComfyUI-ListHelper". The resulting PSD is 8-bit RGB/RGBA and opens in Photoshop CS6+, GIMP, and Affinity Photo.

Where people get burned

The skipped-first-image rule is the one that surprises people - the first image of your batch is silently absent from the PSD. If your batch isn't ordered as [preview, layer1, layer2, …], you'll wonder where a layer went. Also, only RGB and RGBA inputs are supported; a grayscale or unusual-channel batch will error out with a clear message. And if the PSD opens but transparency looks wrong, check whether you actually had alpha in the source - the node detects alpha per layer, so images that never carried transparency won't magically get it. For its intended workflow, this is one of the cleanest "get it out of ComfyUI and into a real editor" nodes around.

CategoryListHelper/Tools

Inputs (3)

NameTypeDefaultDescription
imagesIMAGE
filename_prefixSTRINGComfyUI_PSDPrefix for the output PSD filename
reverse_layer_orderoptBOOLEANfalseReverse the order of layers in PSD (bottom to top)

Outputs (1)

NameTypeDescription
messageSTRING