Nodes/Save Layers Node for ComfyUI/LayersSaver - Save Layer
ComfyUI Node

LayersSaver - Save Layer

Turn your mask stack into an actual layered PSD — no Photoshop involved

By alessandrozonta·Created 2 years ago·Updated 2 years ago· 59
LayersSaver - Save Layer
  • input_image
  • masks
  • layers
output_path
original_imagetrue

You've done the hard part. You ran BiRefNet or SAM, got clean cutouts and a stack of masks, and now you have a pile of transparent PNGs you're going to composite by hand anyway. LayersSaver - Save Layer is the node that skips the manual re-layering: it takes one image plus a batch of masks, multiplies them together, and writes each masked region into a single .psd as its own editable layer.

It's a tiny, almost forgotten tool - the pack it ships in has ~60 stars and hasn't been touched since mid-2024 - but for this one job it does exactly what it says on the tin.

What it actually does

Feed it one image and a batch of masks. It produces a Photoshop file where every mask turns into a layer (Masked_1, Masked_2, …), and if you want it, the untouched original sits underneath as an Original Image layer. That's the whole deal - a designer-facing deliverable straight out of the graph, not "here are 14 PNGs, good luck."

No models, no GPU, no API. It's pure file-writing: the masks get multiplied against the image pixel-by-pixel, each result becomes a layer record, and the whole stack is written out with pytoshop. If you've got a background-removal or segmentation pipeline, this is the deliverable step it was missing.

The inputs that matter

The full list is short - you can learn it in one glance:

  • input_image - a single image. Feed it a batch and it throws Batch input is not supported. Use the sibling "Save Layer From Images" node if you have multiple images instead.
  • masks - the batch of masks. They have to match the image dimensions exactly, or you get a Mask dimensions must match the input image dimensions error.
  • output_path - the one that bites. If it doesn't end in .psd, the node treats it as a folder, creates it if needed, and writes a timestamped layered_image_<date>.psd inside. If it ends in .psd, it writes to that file directly. Leave it empty and you get a confusing FileNotFoundError - always type a real path.
  • original_image - a boolean, defaulting to true. Keep it on if you want the un-masked image as the bottom layer; that's the setting that turns the output into a proper before-and-after stack.

The node also returns the masked images as a layers output (type IMAGE) so you can wire a preview node in and eyeball each cutout. It's not an output node, though - the real deliverable is the file on disk.

Installing it

It's on the Comfy Registry, so ComfyUI Manager will find it if you search for ComfyUI-Layers or Save Layers Node for ComfyUI. Or clone it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/alessandrozonta/ComfyUI-Layers
cd ComfyUI-Layers
pip install pytoshop -I --no-cache-dir
pip install psd-tools --no-deps

Then restart ComfyUI. That's the entire dependency story - no model files to hunt down. One warning: the README's own install section tells you to clone github.com/yourusername/..., a placeholder that doesn't exist. Use the real URL above.

Where people get burned

This pack has a handful of open issues and zero responses to them, so set expectations before you lean on it in production.

  • NumPy. The best-known landmine. An open issue reports Manager installs bumping NumPy past 2.0, which made ComfyUI refuse to load or preview images at all. The pack's install.py installs psd-tools with --no-deps to dodge exactly this, but pytoshop still drags NumPy in. If ComfyUI breaks right after install, pin NumPy below 2.0.
  • PSDs that won't open. Open issue: Cannot open psd files, "unexpected end-of-life was encountered". The layers are written with RLE compression, and another issue reports compression corrupting layer output. If you hit it, you're not doing anything wrong - it's the library.
  • Layers pile up. A third issue reports that PSDs grow over time because layers from previous runs get appended until you restart ComfyUI. Annoying, easy to fix with a restart, real.

None of this makes the node useless for a quick mask-to-layers job. Just know you're driving a tool nobody's maintaining, so a fresh look at the source is your best troubleshooting manual.

A tip from someone who's used it: this node slots in at the end of a masking pipeline (BiRefNet → masks → here → PSD). Pair it with original_image on and you hand your designer the before image plus every cutout on its own layer - the most boring, most useful thing you'll do all day.

CategoryLayersDivider

Inputs (4)

NameTypeDefaultDescription
input_imageIMAGE
masksMASK
output_pathSTRING
original_imageBOOLEANtrue

Outputs (1)

NameTypeDescription
layersIMAGE