Nodes/ComfyUI-layerdiffuse (layerdiffusion)/Layer Diffuse Decode (Split)
ComfyUI Node Runs on cloud

Layer Diffuse Decode (Split)

Decode every Nth frame

By huchenlei·Created 2 years ago·Updated about a year ago· 1,777
Layer Diffuse Decode (Split)
  • samples
  • images
  • IMAGE
  • IMAGE
  • IMAGE
frames2
sd_versionSDXL
sub_batch_size16

LayeredDiffusionDecodeSplit is the batch version of the RGBA decode, and it exists for one reason: some LayerDiffusion workflows generate multiple images per sampler run, with the transparent result landing at a fixed position in the batch. When you're running the joint SD 1.5 nodes (LayeredDiffusionJointApply at batch size 3N, or LayeredDiffusionCondJointApply at 2N), the pack's own example workflows finish with this node, not the plain decode.

What "Split" means

The transparent decoder is expensive, and most of the frames in a joint batch don't need alpha at all. So instead of decoding every latent, this node decodes every Nth image as RGBA and passes the rest through untouched.

  • frames - default 2, range 2–3. "Decode RGBA every N output images." In the joint workflows, set it to match the batch grouping: 3 for LayeredDiffusionJointApply (which lays down foreground, background, and blended per group), 2 for the CondJoint nodes.
  • samples (LATENT) - the full latent batch out of the KSampler. Internally it slices samples[::frames], so it only runs the transparent decoder on the frames that carry the alpha.
  • images (IMAGE) - the VAE-decoded RGB for the whole batch.
  • sd_version - SDXL (default) or SD15, matching your checkpoint.
  • sub_batch_size - default 16, decode chunk size for VRAM control.

Output: three IMAGE slots. The first gets the RGBA-decoded frames, the next ones get the original RGB frames at their batch positions, and any slot left over for your chosen frames value comes out None. In the joint workflows, that first output is your foreground (or blended) layer with alpha; the second is the matching companion layer.

Where it shows up

You'll meet it almost exclusively inside the pack's layer_diffusion_joint.json and layer_diffusion_cond_joint_*.json example workflows - those exist specifically because joint generation needs a decode that understands "every Nth image is the one with alpha." Outside that, it's the node to reach for if you're batching transparency generation in groups (say, generating N variants where every Nth is the cutout) and you don't want to run the heavier decode on frames that don't need it.

Gotchas

Same family rules apply: latent dimensions must be multiples of 64 (the decoder asserts both H and W), VRAM runs ~2–3GB hotter than a plain generation, and this is SD 1.5/SDXL-only territory - the whole pack has been dormant since early 2025. The frames setting has to match how your batch is actually laid out, or you'll decode the wrong frames and get garbage alphas; when in doubt, use the joint example workflows as your template rather than building the grouping by hand.

Categorylayer_diffuse

Inputs (5)

NameTypeDefaultDescription
samplesLATENT
imagesIMAGE
framesINT22–3
sd_versionCOMBOSDXL2 options: SD15, SDXL
sub_batch_sizeINT161–4096

Outputs (3)

NameTypeDescription
IMAGEIMAGE
IMAGEIMAGE
IMAGEIMAGE