[Inference.Core] Layer Diffuse Decode (RGBA)
Real Transparency, Straight Out of the Sampler
- samples
- images
- IMAGE
Most "transparent background" workflows are a two-step lie: generate an opaque image, then run a background-removal model that guesses where the edges of transparency should have been. LayerDiffusion skips the guessing entirely - it bakes an alpha channel into the diffusion process itself, so hair strands, smoke, and glass come out with real, model-generated transparency instead of a segmentation model's best approximation. This node is the decode half of that pipeline: it takes the sampled latent and turns it into an actual RGBA image.
The technique was built by lllyasviel - same person behind ControlNet, Forge, and IC-Light - and the idea is a "latent transparency" channel added alongside the normal latent, so the model learns to generate content and its alpha mask simultaneously rather than opaque-first-transparent-later. That's why the edges are clean by construction: nothing has to be reconstructed after the fact, which is the exact thing every post-generation background remover struggles with on fine hair or semi-transparent material.
What this specific node needs: samples, the LATENT that came out of your KSampler on a LayerDiffuse-patched model - you can't just point this at any ordinary sampled latent, the model earlier in your graph needs the corresponding LayerDiffuse UNet patch applied, or there's no transparency information in the latent for this node to decode. images is the normally-decoded opaque IMAGE for that same generation. sd_version (SD15 or SDXL, default SDXL) picks the matching transparent-VAE decoder weights - LayerDiffusion trained separate weight sets per base model, so this has to match whatever checkpoint you actually sampled with. sub_batch_size (default 16) is a VRAM/speed knob for how many frames decode at once - same idea as tiled VAE decoding; turn it down if you're hitting OOM, up if you have headroom to spare. The output is a single IMAGE, but this time it's genuinely RGBA - a real alpha channel, not a composited guess.
Here's the honest part: this technology has stalled. lllyasviel's own sd-forge-layerdiffuse repo is still marked [WIP] with a last commit from August 2024, and the ComfyUI port hasn't moved since February 2025. There's no Flux-era or Z-Image-era successor, and nobody's building one - as one frustrated user put it at the time, LayerDiffusion "would have been the absolute goat tool on the market if it hadn't been abandoned." So this only works if you're deliberately on SD 1.5 or SDXL. If you are, though, it's still the best transparency you can get - nothing newer has replaced it, because nothing newer does this at all.
Installing it: comes bundled in LykosAI's ComfyUI-Inference-Core-Nodes - LykosAI also makes Stability Matrix, the meta-installer a lot of people use for managing local SD UIs, so this pack's install path is unusually well thought out for a node repo. Search "ComfyUI-Inference-Core-Nodes" in ComfyUI Manager, or go manual: cd ComfyUI/custom_nodes && git clone https://github.com/LykosAI/ComfyUI-Inference-Core-Nodes, then run install.py against ComfyUI's Python environment, or pip install -e .[cuda] / .[cuda12] / .[rocm] / .[directml] / .[cpu] for accelerated onnxruntime, or plain pip install -e . without it. Restart ComfyUI. The transparent-VAE decoder weights themselves are a separate download the node pulls in on first use - expect a pause the first time you run this node while it fetches them.
Troubleshooting: beyond the pack-wide install issues (ModuleNotFoundError: No module named 'inference_core_nodes' if the Python install step didn't complete, usually from targeting the wrong interpreter on a portable ComfyUI build), the LayerDiffuse-specific gotcha is mismatch errors between sd_version and your actual checkpoint - if you sampled on SD 1.5 but tell this node SDXL (or vice versa), decoding will fail or produce garbage, since the two use different decoder weights entirely. And remember this node alone won't do anything if the earlier sampling stage wasn't run through a LayerDiffuse-patched model - check that the patch node is in your graph before assuming this one is broken.
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 (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |