Nodes/ComfyUI-PSD2Layer/Apply Alpha to Layers
ComfyUI Node

Apply Alpha to Layers

Re-stitch your edited layers' alpha after processing

By Nolan0722·Created 2 months ago·Updated about a month ago· 7
Apply Alpha to Layers
  • images
  • layer_info
  • layer_image
backgroundnone
restore_original_scalefalse

If you split a PSD, ran your layers through something generative, and now have a pile of edited RGB images with no alpha channel to show for it - this is the node that fixes that. Apply Alpha to Layers takes your processed images and the original layer_info (the metadata side channel from PSD to Layers) and re-attaches each layer's alpha channel, so the transparency you had before survives whatever you did to the pixels.

Why you need a dedicated node for this: most image-processing nodes in ComfyUI are RGB-only. The moment an upscaler or an edit pass touches your layer, the alpha that defined its shape is gone or wrong-sized. This node's whole job is to keep the original alpha in sync with the new, possibly resized, pixels - then hand you back a clean list of layer_image tensors ready for the rebuild.

The inputs that matter

  • images - your processed layer images, in the same order as they came out of PSD to Layers. The node zips them against layer_info by index, so keep the order straight.
  • layer_info - the bypassed metadata list. This is the side channel that never went through your processing; wire it straight from PSD to Layers.
  • background - none (default) keeps the output RGBA; black/white/gray composite the alpha onto a solid color and output 3-channel RGB. Same rule as the splitter: pick a solid if your downstream node refuses 4-channel images.
  • restore_original_scale - the one that confuses everyone, so pay attention. It defaults to False, meaning the alpha is resized to match your processed image's dimensions. That's what you want when you upscaled and intend to keep the bigger result. Flip it to True and it shrinks both image and alpha back to the layer's original size from layer_info - for when your processing changed resolution but you want the document to stay exactly as it was.

The error you'll actually hit

len(images) must equal len(layer_info). Drop a layer, skip an index, merge two of them upstream, and you get a hard error telling you the counts don't match. It's annoying the first time and a lifesaver after that, because it catches the exact case that would otherwise silently corrupt a rebuild. If you see it, go check that your processing chain didn't collapse the list.

Install

Pack-wide, one time: ComfyUI Manager → search ComfyUI-PSD2Layer, or cd ComfyUI/custom_nodes && git clone https://github.com/Nolan0722/ComfyUI-PSD2Layer && pip install -r requirements.txt, then restart. Light deps only - psd-tools, Pillow, numpy - nothing to download beyond the pack itself.

One honest caveat: alpha resizing is done with LANCZOS on the stored 0–1 alpha tensor, so a heavily-downscaled original edge can get slightly soft. For anything short of extreme resolution changes you won't notice it, and it beats the alternative - editing layers with no transparency at all and fighting the rebuild to place them by hand.

CategoryPSD2Layer

Inputs (4)

NameTypeDefaultDescription
imagesIMAGE
layer_infoLAYER_INFO
backgroundCOMBOnone4 options: none, black, white, gray
restore_original_scaleBOOLEANfalse

Outputs (1)

NameTypeDescription
layer_imageIMAGE