Eric Qwen Layer Extract
Turn decoded Qwen frames into proper RGBA layers with masks
- images
- layers
- alpha_masks
- layer_count
- layer_info
The native Qwen layered workflow ends with a VAE decode that hands you a plain batch of images - one per frame. But a batch of RGB frames isn't a set of layers yet; layers need alpha, and the pack's downstream nodes expect layers plus a parallel alpha_masks output. EricQwenLayerExtract is the converter that makes decoded frames look like the output of the Decompose node, so everything after it works identically in both halves of the pack.
What it does
You feed it images (the decoded batch) and it returns layers, alpha_masks, layer_count, and layer_info - the exact same output contract as Decompose. The one input that matters is treat_as, with three options:
- layers: interpret every batch item as a layer (the normal case).
- video_frames: treat them as video frames instead - affects naming and interpretation.
- auto_detect: pick automatically, roughly "small batch = layers."
Alpha handling is where the real logic lives. If the decoded images already have a 4th channel, that becomes the alpha. If they're RGB, generate_alpha (default true) derives alpha from luminance - dark pixels become transparent - with alpha_threshold (default 0.1) controlling the cutoff. Each layer also gets analyzed for coverage and transparency, which lands in the layer_info JSON. It's a lightweight surrogate for the real alpha the model encodes, but it's good enough to feed straight into Layer Save or Composite.
Why it exists
In the diffusers Decompose workflow, the pipeline hands back real RGBA layers with genuine alpha and you never think about this. In the native workflow, you decode a multi-frame latent and get RGB frames with no alpha at all - the model's transparency lives in the RGBA VAE's 4th channel, and whether it survives decoding depends on your setup. This node is the bridge: it turns whatever the VAE gave you into the layer format the rest of the pack expects, and if the alpha didn't survive, it fabricates a reasonable approximation.
The full chain it terminates:
Multi-Layer Latent → KSampler → Latent Cut to Batch → VAE Decode → [Layer Extract] → Save
Caveats
The luminance-derived alpha is a fallback, not the model's true transparency. If you're doing pixel-critical compositing, prefer the diffusers Decompose path where the real RGBA comes through, or feed generate_alpha false and supply your own masks. And if treat_as is set to auto_detect, batch size decides the interpretation - a 12-layer batch can get classified as video frames and come out named "Frame_1" instead of "Layer_1". Experimental "Native" category, so expect to eyeball results. Install via ComfyUI Manager (search "Eric Qwen") or git clone https://github.com/EricRollei/Qwen_Layers_Diffuser_Pipeline_Comfyui into custom_nodes, then restart.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| treat_as | COMBO | layers | How to interpret the batch dimension |
| alpha_thresholdopt | FLOAT | 0.100–1 | Threshold for generating alpha masks from RGB |
| generate_alphaopt | BOOLEAN | true | Generate alpha from dark regions if no alpha channel |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| layers | IMAGE | — |
| alpha_masks | MASK | — |
| layer_count | INT | — |
| layer_info | STRING | — |