Nodes/ERPK Collection/Qwen Image Layered
ComfyUI Node

Qwen Image Layered

Decompose one image into editable RGBA layers

By eRepublik-Labs·Created 11 months ago·Updated 21 days ago· 1
Qwen Image Layered
  • client
  • images
  • masks
image
seed-1
prompt
num_layers4
enable_sync_modefalse
enable_base64_outputfalse

Qwen Image Layered is the oddball in the pack's WaveSpeed section, and it's genuinely cool: feed it a single image and it decomposes it into separate RGBA layers - foreground subject, background, objects - with transparency built in. Out the other side you get a batch of layer images and a matching batch of alpha masks, ready for compositing work. It's like asking a model to do the layer separation you'd normally do by hand in Photoshop.

It's a WaveSpeed-hosted Qwen capability, so the mechanics are a billed API call: the image goes up, the model reasons about the scene's depth and object boundaries, and the result comes back as multiple layers. You control the granularity with num_layers - 2 to 8, default 4. More layers means finer separation (and, realistically, more chances for the model to split something oddly); fewer means chunkier, safer cuts. The prompt input lets you steer the decomposition - describe what matters ("keep the person separate from the car, merge the road and sky") in Chinese or English.

The inputs and outputs

  • image - the image to decompose, as a URL or path (a string, not a tensor)
  • num_layers - 2 to 8, default 4
  • prompt - optional guidance for how to split the scene
  • seed - cache control; randomize for a fresh decomposition each run
  • enable_sync_mode / enable_base64_output - completion and encoding behavior
  • client - optional WaveSpeed client

The two outputs are the point: images (IMAGE batch, the layer RGBs) and masks (MASK batch, one alpha per layer). Wire them into compositing nodes - the mask batch is exactly what the pack's Region Mask-style tooling or any mask-based compositor wants. Layer 1 through N correspond positionally between the two outputs, so images[i] pairs with masks[i].

Install and setup

cd ComfyUI/custom_nodes
git clone https://github.com/eRepublik-Labs/comfyui-nodes-erpk.git erpk
cd erpk && pip install -r requirements.txt

Or "ERPK Custom Nodes" from ComfyUI Manager, restart, and set a WaveSpeed API key in ERPK Settings (right-click canvas).

Troubleshooting and honest expectations

"Image must be provided" is the validation error you'll hit if you queue it empty - no surprise there. The bigger caveat is expectations: model-based layer separation is impressive but not pixel-surgical. A busy scene with overlapping subjects will come back with imperfect edges, and num_layers doesn't guarantee the kinds of layers you want - you might get "person / background / shadow" instead of "person / car / road / sky." That's what the prompt guidance is for. If your source is a clean product shot or a single subject on a simple background, this node can save you serious masking time. For chaotic scenes, budget for cleanup. The transparency genuinely is real though - that's the part people don't expect, and it opens up the whole compositing toolbox.

CategoryERPK/WaveSpeedAI

Inputs (7)

NameTypeDefaultDescription
imageSTRINGThe image to decompose into layers (URL or path)
seedINT-1-1–2147483647Seed for cache control. Randomizes by default.
promptoptSTRINGOptional text description to guide layer decomposition (Chinese or English)
clientoptWAVESPEED_AI_API_CLIENTWaveSpeed API client (optional if API key is configured in Settings)
num_layersoptINT42–8Number of layers to decompose into (2-8)
enable_sync_modeoptBOOLEANfalseWait for completion before returning response
enable_base64_outputoptBOOLEANfalseReturn BASE64-encoded output instead of URL

Outputs (2)

NameTypeDescription
imagesIMAGE
masksMASK