Nodes/ComfyUI-layerdiffuse (layerdiffusion)/Layer Diffuse Decode (RGBA)
ComfyUI Node Runs on cloud

Layer Diffuse Decode (RGBA)

Transparency already glued in

By huchenlei·Created 2 years ago·Updated about a year ago· 1,777
Layer Diffuse Decode (RGBA)
  • samples
  • images
  • IMAGE
sd_versionSDXL
sub_batch_size16

This is the decode node from the pack's simplest example workflow, and the one most people should start with. It does exactly what the plain LayeredDiffusionDecode does - reconstruct the alpha channel that the patched sampler hid in the latent - but instead of handing you RGB and a separate mask, it returns a single IMAGE with the alpha already embedded. Save that with a PNG Save node and you have a transparent cutout, full stop.

How it works

Same transparent VAE decoder as the sibling nodes, same two required inputs, so the wiring is identical:

KSampler ─→ VAEDecode ─┐
          └─ (samples) ├→ LayeredDiffusionDecodeRGBA → PNG Save

Feed it the KSampler's latent as samples and the VAE-decoded RGB as images. It decodes the alpha from the latent, inverts it (alpha = 1 − mask, since the raw decoder emits a mask where white is transparent), and joins the channels back into one RGBA image via ComfyUI's JoinImageWithAlpha. No mask wrangling, no second output to keep in sync.

Inputs and outputs

  • samples (LATENT) - the finished latent from the KSampler running on your LayeredDiffusionApply-patched model.
  • images (IMAGE) - the ordinary VAEDecode result. Both inputs must be present; this node won't decode from the latent alone.
  • sd_version - SDXL or SD15, matching your checkpoint. Controls which transparent-decoder weight loads (vae_transparent_decoder.safetensors for SDXL, layer_sd15_vae_transparent_decoder.safetensors for SD 1.5). Both auto-download to ComfyUI/models/layer_model.
  • sub_batch_size - default 16, decode chunk size. Lower it if you're VRAM-crunched.

Output: a single IMAGE in RGBA.

When to reach for it vs. the plain decode

If you're making transparent PNGs for compositing or product shots, take this one - it's the least moving parts. Reach for LayeredDiffusionDecode instead when you want the alpha as a real MASK object (to blur, feather, threshold, or run through mask-based nodes), or when a downstream tool mangles RGBA and you'd rather keep the channels separate yourself.

Same traps as the rest of the family: latent dimensions must be multiples of 64 (the decoder asserts it - a 1000×1000 generation will fail here), most ComfyUI nodes silently flatten RGBA if you route through them, and the whole pack is SD 1.5/SDXL-only with no movement since roughly early 2025. Budget an extra 2–3GB of VRAM over a plain generation. But when it works, the edges are clean by construction - no background-removal network guessing where the hair ends.

Categorylayer_diffuse

Inputs (4)

NameTypeDefaultDescription
samplesLATENT
imagesIMAGE
sd_versionCOMBOSDXL2 options: SD15, SDXL
sub_batch_sizeINT161–4096

Outputs (1)

NameTypeDescription
IMAGEIMAGE