ComfyUI Node Runs on cloud

Layer Diffuse Apply

The node that lets Stable Diffusion draw a transparent PNG directly

By huchenlei·Created 2 years ago·Updated about a year ago· 1,777
Layer Diffuse Apply
  • model
  • MODEL
config
weight1.00

This is the node you plug in when you want a character, product, or any subject on a genuinely transparent background - alpha baked in during generation, not cut out afterwards. The name is literal: "Layer Diffuse" means the diffusion model itself learns to emit an alpha channel, so hair strands, smoke, and glass edges get real partial transparency instead of a guessed silhouette. It's the flagship node of huchenlei's ComfyUI port of lllyasviel's LayerDiffusion, and it's still the best-looking transparency this ecosystem has ever produced - with the asterisk that it only works on SD 1.5 and SDXL. There is no Flux version, and the code has been dormant since early 2025.

What it actually does

LayeredDiffusionApply takes your unmodified checkpoint and patches it with a small LayerDiffusion LoRA-style weight file so that the model generates content with a hidden alpha channel in the latent. It does not decode anything itself - you still run a normal KSampler after it, then hand the results to a LayeredDiffusionDecode node, which is where the alpha actually comes out.

The workflow you'll copy from the pack's README:

CheckpointLoaderSimple → LayeredDiffusionApply → KSampler ─→ VAEDecode ─→ LayeredDiffusionDecodeRGBA
                                                         └─ (samples) ─────────┘

Load your checkpoint, patch it here, run the sampler as usual, and feed both the sampler's latent (samples) and the VAE-decoded RGB (images) into the decode node. What comes out is a PNG with alpha. That second input is the part people forget: the transparent decoder needs the pre-alpha RGB image alongside the latent to reconstruct the alpha channel.

The three inputs that matter

  • model - the MODEL from your checkpoint loader. It gets cloned and patched in place, so nothing downstream is permanently changed.
  • config - pick the one matching your checkpoint. SDXL, Attention Injection and SDXL, Conv Injection are two ways of doing the same job on SDXL (attention injection is the usual default; conv injection is the alternate from the paper, and there's little reason to switch unless you're comparing). SD15, Attention Injection, attn_sharing is the SD 1.5 variant. Pick the wrong SD version and the node throws an assertion - it checks your model's version against the config.
  • weight - default 1, range −1 to 3. It scales the patch strength. Crank it down toward 0 if the transparency effect feels too weak or the subject drifts toward the promptless edge cases; the SDXL attention model is the one where people actually tune this.

Output: a single MODEL, wired straight into your KSampler.

Install

ComfyUI Manager (search "layerdiffuse"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/huchenlei/ComfyUI-layerdiffuse

then pip install -r requirements.txt (diffusers and opencv-python) and restart. The model weights - layer_xl_transparent_attn.safetensors, layer_xl_transparent_conv.safetensors, or layer_sd15_transparent_attn.safetensors - are not downloaded manually; they auto-download from Hugging Face into ComfyUI/models/layer_model on first use.

Where people get burned

  • Generation dimensions must be multiples of 64. The decode step asserts on this and errors out otherwise. Keep your EmptyLatentImage at, say, 1024×1024 or 512×768, not 1000×1000.
  • Alpha gets silently dropped. Many ComfyUI nodes don't know how to handle RGBA and will flatten your transparency without warning. Save with a PNG Save node, and don't route your result through anything that re-encodes casually.
  • VRAM: budget an extra ~2–3GB over a normal generation.
  • It's frozen. The pack last moved around February 2025, so treat it as a solved-but-stalled tool: brilliant on SD 1.5/SDXL, and a dead end for anything newer.
Categorylayer_diffuse

Inputs (3)

NameTypeDefaultDescription
modelMODEL
configCOMBO3 options: SDXL, Attention Injection, SDXL, Conv Injection, SD15, Attention Injection, attn_sharing
weightFLOAT1.00-1–3

Outputs (1)

NameTypeDescription
MODELMODEL