QwenImage Layered V2 Decompose
Pull one RGBA layer out of a flat image — and mind the brush
- pipeline
- image
- context_image
- target_mask
- remove_mask
- layer_image
This is the node that actually does the thing: it takes your image, runs the Qwen-Image-Layered V2 pipeline from the QwenImage Layered V2 Loader, and returns one isolated RGBA layer. Think of Layered as the model that finally gives raster images the thing LayerDiffusion could only fake on SDXL - native alpha that doesn't have to be matted out afterward. Every layer you pull becomes a PNG with its own transparency, which you can composite, re-prompt, or re-light without touching the rest of the picture.
The honest caveat up front, because the README leads with it: the context_image brush is soft conditioning, not a hard inpaint mask. It steers what the model pulls, it does not guarantee a pixel-exact extraction. If the output crops, redraws, or wanders off your brush region, that's a known limitation of this route, not a bug in your workflow. For precision work, masked inpainting still owns bit-identical pixels; this is for getting a separated element - foreground, background, a poster's text layer - out with real alpha.
How it works
The node resizes your input to the model's working size (rounded to a multiple of 16), builds or receives the RGBA context_image, and calls DiffSynth's pipeline with layer_input_image, layer_num, and the context. It returns a single layer_image - RGBA, so the alpha channel is right there - which you feed to a Preview or Save node. Want the background instead of the subject? Run it again with the layers flipped. That's the "recursive decomposition" trick: each call extracts one layer, and you can chain them until everything's separated.
The inputs that matter
prompt- describe the whole image, like you're captioning it. Do not write "cut out", "isolate layer", "mask" or any extraction instruction; the brush already tells it what to pull, and cutting language makes it fight you.steps(default10) andcfg_scale(default1.0). The README's recipe: start at 10 steps, bump them when occlusion gets complex, and keepcfg_scaleat 1.0 when a brush is attached - it trusts the brush more that way.layer_num(default0) - which layer in the stack to extract. 0 is the usual starting point; bump it when you want the next layer up.use_input_size(defaultTrue) - keeps your image's aspect ratio and current size. Turn it off andwidth/height(both default 1024, stepped by 16) become the manual output size.seed- same seed, same layer, useful when you're hunting for a good pull.
Optionally it also takes negative_prompt, context_image, and the raw target_mask / remove_mask - if you skip the Brush Context node entirely, you can wire masks straight in here and it builds the RGBA context internally. Either connection style works.
The trap: red vs green
The brush context encodes intent by color: red means "extract this", green means "exclude this", and where both overlap you get yellow - the occluded back layer that sits behind your target. The classic failure is output that looks like it dug a hole where you brushed. That means your target region landed in the green channel (or the model read it backwards). Before re-running a 10-step sample, plug the Brush Context output into a PreviewImage and check: is your region red? If not, flip invert_target on the Brush Context node. Cheap to check, expensive to guess.
One more tip: use_input_size is on by default, so a small input image stays small through the pipeline. If your layer comes out blocky, upscale the input before decomposing rather than reaching for width/height - the model works better on bigger source frames.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| pipeline | QWEN_LAYERED_V2_PIPELINE | — | |
| image | IMAGE | — | |
| prompt | STRING | — | |
| seed | INT | 00–18446744073709550000 | — |
| steps | INT | 101–100 | — |
| cfg_scale | FLOAT | 1.00–20 | — |
| width | INT | 1024256–4096 | — |
| height | INT | 1024256–4096 | — |
| layer_num | INT | 00–32 | — |
| use_input_size | BOOLEAN | true | — |
| negative_promptopt | STRING | — | |
| context_imageopt | IMAGE | — | |
| target_maskopt | MASK | — | |
| remove_maskopt | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| layer_image | IMAGE | — |