PreSampling (LayerDiffuse)
PreSampling (LayerDiffuse) – ComfyUI Node Guide
- pipe
- image
- blended_image
- mask
- pipe
LayerDiffusion generates transparency during diffusion instead of removing a background afterward - the alpha channel comes out of the model itself, so there's no segmentation model guessing where the edges are. That's a genuinely different (and often better-looking) approach than running rembg or BiRefNet on a finished image, and this node is Easy-Use's wrapper around it, bundled with a matching pre-sampling config.
What it's actually built on. Under the hood this wraps ComfyUI-layerdiffusion (huchenlei's port of lllyasviel's sd-forge-layerdiffuse), which is why it shows up in the pack's presampling family rather than as a standalone effect node - you configure the LayerDiffusion pass and your usual sampling parameters together, then pipe the result into an easy kSampler. It's worth knowing the upstream status before you build around this: sd-forge-layerdiffuse is still flagged [WIP] in its own repo and hasn't had a commit since August 2024; the ComfyUI port last moved in February 2025. There is no Flux-era or Z-Image-era version. It only works on SD1.5 and SDXL. If your workflow is built on anything newer, this node isn't an option no matter how good the results look on older checkpoints.
The method input is the real decision point. Five choices: Attention Injection and Conv Injection are the two underlying mechanisms LayerDiffusion can use to bake in transparency; Everything produces a single transparent-background image; Foreground and Background are compositing modes, where you're generating a layer meant to combine with another layer rather than a standalone transparent PNG. If you pick Foreground or Background, you'll want the companion node - easy preSamplingLayerDiffusionADDTL - to feed separate prompts for each layer; on its own this node assumes one shared prompt from the pipe.
Other inputs. weight (-1 to 3, default 1) controls how strongly the LayerDiffusion effect applies. steps, cfg, sampler_name, scheduler, denoise, seed are the standard sampling block. Optional image and blended_image let you feed reference images in (relevant for compositing workflows), and optional mask restricts where the effect applies. Required input is pipe; output is pipe.
Install - and this one actually needs an extra step. Base pack install is the usual ComfyUI Manager search ("ComfyUI Easy Use") or:
cd ComfyUI/custom_nodes
git clone https://github.com/yolain/ComfyUI-Easy-Use
then restart. But per the pack's own README: the first time you use LayerDiffusion features, you likely need to run pip install -r requirements.txt inside the cloned Easy-Use folder to pull in the dependencies this specific feature needs - it isn't guaranteed to be covered by the base install.
Common issues. The most common failure is trying this on a checkpoint family it was never built for - Flux, Z-Image, anything post-SDXL - where it either errors outright or silently does nothing useful, because the LayerDiffusion weights are checkpoint-specific and none exist past SDXL. Second most common: forgetting the extra pip install -r requirements.txt step and hitting an import error the first time the node actually runs. If you need clean transparency on a modern model, this isn't the tool - it's a strong, still-underrated option specifically for SD1.5/SDXL work, not a general-purpose background remover.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| pipe | PIPE_LINE | — | |
| method | COMBO | 5 options: Attention Injection, Conv Injection, Everything, Foreground, Background | |
| weight | FLOAT | 1.00-1–3 | — |
| steps | INT | 201–10000 | — |
| cfg | FLOAT | 8.000–100 | — |
| sampler_name | COMBO | euler | 44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38 |
| scheduler | COMBO | normal | 11 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +5 |
| denoise | FLOAT | 1.000–1 | — |
| seed | INT | 00–1125899906842624 | — |
| imageopt | IMAGE | — | |
| blended_imageopt | IMAGE | — | |
| maskopt | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| pipe | PIPE_LINE | — |