ComfyUI Node

D2 Save PSD

Ship a layered PSD straight out of ComfyUI (masks are a separate problem)

By da2el-ai·Created about a year ago·Updated about a year ago· 8
D2 Save PSD
  • images
    filename_prefixComfyUI
    file_mode
    alpha_name_mask_
    alpha_name_mode

    You generated a batch of assets and now someone needs them in Photoshop - a client, a compositor, a game artist. PNGs are fine until they ask for layered files, and at that point ComfyUI's built-in Save Image taps out. That's the gap D2 Save PSD fills: it writes real .psd files into ComfyUI's output folder, one layer per image.

    It's the headline node of D2-SavePSD-ComfyUI, a small three-node pack by the Japanese developer da2el, first cut in April 2025 and sitting at version 0.11.0. The other two nodes - D2 Apply Alpha Channel and D2 Extract Alpha - exist to feed and un-feed this one's alpha handling. It's a thin, focused utility: CPU-only, no model downloads, no heavy dependencies.

    How it works

    Under the hood it uses the psd-tools library to build PSDs in memory, no temp files. For each image it splits off any alpha channel, converts it to a greyscale layer, and adds it as a hidden layer named _mask_ - then adds the RGB image as a normal layer on top. Files land in the same output folder as Save Image, with the same counter naming, because it reuses ComfyUI's standard save-image path. If the PSD write ever fails, it logs a warning and falls back to saving plain PNGs instead of dying.

    The catch you need to know before you promise anyone "layered with masks"

    The README is upfront about it: layer masks are not implemented (as of the 2025-04-07 release). Your alpha comes out as a normal hidden layer, not an actual Photoshop mask. The author documents two workarounds - a manual copy-paste procedure in Photoshop, or the bundled d2_automask.jsx script (tested on Photoshop CC 2024) that batch-applies masks to a folder of PSDs. So plan for a follow-up step if you need true masks, or keep the client happy with a hidden mask layer and call it a day.

    The inputs that matter

    • images - the batch to export.
    • filename_prefix - same format as Save Image, including %batch_num%. Default ComfyUI.
    • file_mode - single_file stacks the whole batch into one PSD (each image a layer); multi_file writes one PSD per image. Note from the source: single_file reverses layer order so the last batch image ends up on top.
    • alpha_name / alpha_name_mode - the mask layer's name (_mask_ by default; suffix appends it to the image layer name). If you plan to run the bundled automask script, keep alpha_name_mode on simple so the mask layer name stays uniform.

    No outputs - it's an output node; it writes files.

    The workflow shape

    The natural path is D2 Apply Alpha Channel (mask → alpha) → D2 Save PSD. You can also feed it RGBA straight from a transparent-generation pipeline - and this is where it shines, because a lot of ComfyUI nodes silently drop alpha along the way. Hook the save node as close to the VAE decode as you can. If you need heavier duty - actual layer groups, blend modes, composite modes - the better-known alternative is ComfyUI-LayerDivider; D2-Save-PSD is the lighter "just give me layers" option.

    Install

    ComfyUI Manager (search "D2-SavePSD-ComfyUI"), or:

    cd {ComfyUI}/custom_nodes
    git clone https://github.com/da2el-ai/D2-SavePSD-ComfyUI.git
    

    Then the step everyone skips: this pack ships an install.py instead of a requirements.txt, and the README is explicit that you must run it even after a Manager install. On Windows: ..\..\venv\Scripts\activate then python install.py; on Linux, activate your env and run python install.py from the pack folder. It installs psd-tools and scikit-image. No model files.

    Common issues

    • ModuleNotFoundError: psd_tools - you skipped install.py. Run it.
    • The mask shows up as a layer, not a mask - that's by design, see above.
    • No alpha in the PSD at all - your input was 3-channel; push it through D2 Apply Alpha Channel first.
    • PNGs where PSDs should be - the PSD write failed and it fell back; check the ComfyUI log for the psd-tools error.
    CategoryD2/Image

    Inputs (5)

    NameTypeDefaultDescription
    imagesIMAGE
    filename_prefixSTRINGComfyUI
    file_modeCOMBO2 options: multi_file, single_file
    alpha_nameSTRING_mask_
    alpha_name_modeCOMBO2 options: simple, suffix

    Outputs (0)

    No outputs