ComfyUI Node

Psd2Png

Psd2Png

By violet-chen·Created 3 years ago·Updated about a year ago· 21
Psd2Png
    • image
    • top_image
    • bottom_image
    • mask
    • is_exist_layer
    image
    psd_pathC:/example.psd
    layer_index0

    ComfyUI has no native way to open a .psd file. The LoadImage node takes png, jpg, webp and friends, and if your assets live in Photoshop layered files you're stuck exporting flat PNGs by hand. Psd2Png is the bridge nobody bothered to ship: point it at a layered file and it hands you the flattened image, the top and bottom layers, and an alpha mask - ready to feed straight into an inpainting workflow. No Photoshop installed, no API key, no Photoshop running on the machine. The name is a little underselling it, honestly. It's not "psd to png," it's "pull the pieces out of a psd."

    Who actually reaches for this? The niche where the artist keeps the composition in Photoshop and wants the AI to work inside it. Two setups keep coming up. First, background removal: a PSD with a transparent background gives you a ready-made mask, so you can have the model generate a new background only where the old one was. Second, layer isolation: pick a single layer and run it through img2img or ControlNet without ever touching an export dialog. People have wanted layered-file workflows in ComfyUI for a while - the community's go-to for saving layered PSDs is a separate pack, and the reading side of that equation was basically empty before this.

    How it works

    The whole mechanism rides on psd-tools, a Python library that reads PSD files without Photoshop. That's the only dependency in the pack - no models, no torch extras. The node opens your file, walks the layer tree, and flattens individual layers with compose(). Each output is a normal ComfyUI IMAGE or MASK tensor, so everything downstream just works.

    Layer numbering follows Photoshop convention: 1 is the bottommost layer and the top layer has the highest number. layer_index 0 is special - it returns the whole flattened file.

    The inputs that matter

    • image - this is really a file picker. It lists the contents of your ComfyUI/input folder, so drop the .psd in there (or drag it into the widget if it'll take it).
    • psd_path - defaults to C:/example.psd, which is a sentinel, not a real path. Leave it alone and the node uses the file you picked. Type a real path and it reads from there instead, which is handy if your PSDs live elsewhere.
    • layer_index - which layer to pull, from 0 (flattened) up.

    The outputs

    image is the flattened file (or your chosen layer), top_image and bottom_image are always the topmost and bottommost layers - useful for comparing. mask is the alpha of the chosen layer, inverted to ComfyUI convention: transparent pixels become 1 (regenerate here), opaque pixels become 0 (leave alone). That's exactly the polarity a standard inpainting stack wants.

    The quiet useful one is is_exist_layer, a float that's 1.0 when your layer exists and 0.0 when you asked for something out of range - and in that case the node silently falls back to the top layer instead of erroring. Wire that float into a switch and you can branch a workflow on whether a layer was found.

    Installing

    Via ComfyUI Manager, search "comfyui-psd2png". Or the manual way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/violet-chen/comfyui-psd2png
    

    Then make sure the one dependency is in ComfyUI's Python environment (on the Windows portable build that's python_embeded\python.exe -m pip install psd-tools):

    pip install psd-tools
    

    That's it. No model downloads, no weights to fetch.

    Where people get burned

    The C:/example.psd default trips everyone up on Windows - it means "use the uploaded file," so change it only when you actually have a file at the new path, or the node throws. On Linux or macOS, write the path with forward slashes. If you git-clone by hand and skip the psd-tools install, you'll get a ModuleNotFoundError the first time the node runs - that's the README's one explicit step, and it's the one people skip.

    Also worth knowing: psd-tools isn't a pixel-perfect Photoshop clone. Exotic layer styles, some smart objects and adjustment layers flatten imperfectly. If a PSD has been round-tripped through a dozen plugins, check the flattened preview before you trust it as a mask. For normal art files it's fine - this is a two-minute install that saves you from a lifetime of manual PNG exports, and if you never touch PSDs you can skip it entirely.

    Categoryimage

    Inputs (3)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png
    psd_pathSTRINGC:/example.psd
    layer_indexINT00–999

    Outputs (5)

    NameTypeDescription
    imageIMAGE
    top_imageIMAGE
    bottom_imageIMAGE
    maskMASK
    is_exist_layerFLOAT