Layer Diffuse Diff Apply
Pull the background out of a blended image
- model
- cond
- uncond
- blended_latent
- latent
- MODEL
- CONDITIONING
- CONDITIONING
Most of this pack adds transparency to generation. LayeredDiffusionDiffApply goes the other way: it separates a composite. Given a blended image plus one of its layers, it regenerates the other layer. Blended + background → the foreground, cut out with native alpha. Blended + foreground → a clean background. It's the highest-traffic node in the pack (the most-Googled of the LayerDiffuse family), and it's SDXL-only.
How it works
The mechanism is the same concat-conditioning trick as LayeredDiffusionCondApply, with one twist: where CondApply injects a single image, this node injects two - your known layer and the blend - stacked together. Internally it concatenates the two latents along the channel dimension (torch.cat([latent, blended_latent], dim=1)) and feeds that as the c_concat condition, alongside the patch weights (fgble2bg or bgble2fg, auto-downloaded to models/layer_model).
So you feed it:
- blended_latent - the composite image, VAE-encoded.
- latent - the layer you already have, VAE-encoded.
- config -
SDXL, Foregroundmeans "I have the foreground, give me the background";SDXL, Backgroundis the reverse. - cond / uncond - your prompts; they come back out modified, exactly like CondApply.
- weight - default
1, −1 to 3, patch strength.
Outputs: the patched MODEL, plus the modified CONDITIONING pair, all three into a KSampler → VAEDecode.
Two honest caveats from the author's own README
- Extracting the background is the weak spot. The README says the BG-extraction workflow "might be inferior compared to other object removal workflows," and the Forge implementation adds a
stop atparameter (defaulting to 0.5) specifically because running the diff weights through the whole denoise ruins the background quality. In ComfyUI that param can't be implemented cleanly, so the pack fakes it with a second img2img pass on the result - that's what thelayer_diffusion_diff_bg_stop_at.jsonexample is doing. If you only care about cutting a subject out of an image you already have, honestly, a BiRefNet-class background remover is usually the better tool; this node shines when the blend and one layer are your generated assets with known lighting. - Extracting the foreground (blended + BG → FG with alpha) is the strong use case - that's the workflow the pack leads with, and it's where native alpha beats any post-hoc cutout.
Pack-wide notes
SDXL/SD 1.5 only (this node is SDXL), dimensions must be multiples of 64, ~2–3GB extra VRAM, and the codebase has been dormant since early 2025 - there's no Flux-era equivalent, so this whole family is a "works great on what it supports, supports nothing newer" situation.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| cond | CONDITIONING | — | |
| uncond | CONDITIONING | — | |
| blended_latent | LATENT | — | |
| latent | LATENT | — | |
| config | COMBO | 2 options: SDXL, Foreground, SDXL, Background | |
| weight | FLOAT | 1.00-1–3 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |
| CONDITIONING | CONDITIONING | — |
| CONDITIONING | CONDITIONING | — |