Layer Diffuse Decode
The node that turns a latent into an alpha channel
- samples
- images
- IMAGE
- MASK
Every LayerDiffusion workflow ends at one of the decode nodes - this is the one that gives you the transparency as a separate mask, rather than glued into an RGBA image. If you want the alpha as a MASK you can manipulate, threshold, blur, or feed into compositing nodes, this is your node. If you just want a transparent PNG out, the RGBA variant is simpler. Same decoder underneath, different outputs.
Why it exists
LayeredDiffusionApply patches your checkpoint so the KSampler produces latents that carry hidden alpha information. But a normal VAE decode throws that away - it only reconstructs RGB. This node runs a transparent VAE decoder (TransparentVAEDecoder, from the same LayerDiffusion family) that takes two things at once: the latent from your KSampler (samples) and the ordinary VAE-decoded RGB image (images). It reconstructs the fourth channel from both and splits it out. The RGB half of the result is identical to what plain VAEDecode gives you; the mask is the new part.
Inputs and outputs
- samples (LATENT) - the latent out of your KSampler. Not the empty latent, the result.
- images (IMAGE) - the RGB output of a normal
VAEDecoderunning on the same latent. Wire both or you get nothing sensible. - sd_version -
SDXL(default) orSD15, whichever your checkpoint is. It picks which transparent-decoder weight to load, so it must match. - sub_batch_size - default
16, how many images the decoder processes per pass. The knob you touch if you're low on VRAM: drop it to 4 or 2.
Outputs are IMAGE (the RGB, with alpha stripped out) and MASK (the alpha, as a standard ComfyUI mask where white is opaque). You can save the pair, invert the mask, or use it as-is.
The decoder weight - vae_transparent_decoder.safetensors for SDXL, layer_sd15_vae_transparent_decoder.safetensors for SD 1.5 - auto-downloads from Hugging Face into ComfyUI/models/layer_model on first use. No manual model step.
The gotcha that gets everyone
Your latent size must be a multiple of 64 in both dimensions. The node asserts H % 64 == 0 and W % 64 == 0 and errors otherwise. A 1000×1000 generation will fail at decode, not at sampling - this is the single most common "why is this broken" post about the pack. Keep your EmptyLatentImage on 64-aligned sizes (1024×1024, 512×768, 896×1152, …).
Also worth knowing: it's a VRAM-hungry decode (the whole pack costs roughly an extra 2–3GB), and the pack itself is stale - SD 1.5/SDXL only, no Flux, code last touched around early 2025. Still, for native transparency on the models it supports, nothing reconstructs edges better, because nothing is reconstructing them at all - the alpha was generated, not cut out.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| samples | LATENT | — | |
| images | IMAGE | — | |
| sd_version | COMBO | SDXL | 2 options: SD15, SDXL |
| sub_batch_size | INT | 161–4096 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |