Nodes/ComfyUI-Loopchain/EmptyLatentImageLoop
ComfyUI Node Runs on cloud

EmptyLatentImageLoop

EmptyLatentImageLoop

By Fannovel16·Created 3 years ago·Updated 3 years ago· 31
EmptyLatentImageLoop
  • opt_pipeline
  • LATENT
  • INT
width512
height512
batch_size1
num_loop1
loop_idx0

ComfyUI has no native for-loops. You can batch, you can iterate inside a sampler, but you can't run the same subgraph ten times and have a counter that walks a keyframe list with each pass. This node is the closest the animation corner of the ecosystem ever got to changing that. EmptyLatentImageLoop from Fannovel16's ComfyUI-Loopchain is an Empty Latent Image that doubles as a loop driver: it makes an empty latent, hands you the current loop index, and its built-in Queue button re-runs the graph as many times as you tell it to.

What it actually is

A stock EmptyLatentImage with three extra things: a num_loop count, a loop_idx widget, and a Queue button. The loop index is the whole point. Wire it into anything that changes per iteration - your prompt text, a seed, a conditioning strength, or one of the pack's storage export nodes - and each queued pass gets a fresh value. That's the loopchain idea in one sentence: a chain of nodes that gets re-executed repeatedly, keyed off an index.

The looping itself is frontend JavaScript, not a Python feature. When you hit Queue on the node, it resets loop_idx to 0, fires the graph, waits about a second, bumps the index, and repeats until it hits num_loop. A small readout on the node shows current loop: 3/16 so you can watch it grind.

The inputs that matter

  • width / height - same as core Empty Latent Image: 64 to 8192, stepped in multiples of 8. The latent is batch_size × 4 × h/8 × w/8.
  • num_loop - how many times the Queue button re-runs the graph. This is your iteration count.
  • loop_idx - the current index, set to 0 and bumped automatically. It's hidden on the node in the shipped version; you generally don't touch it.
  • opt_pipeline - a LOOPCHAIN_PIPELINE input. Plug a Loopchain Pipeline virtual node in here to chain loops in sequence instead of just repeating one.

Outputs are LATENT (pure zeros, feed it to a KSampler exactly like the core node) and INT - the loop index, the wire that makes the whole thing useful.

Installing it

ComfyUI Manager → search "ComfyUI-Loopchain" → install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/Fannovel16/ComfyUI-Loopchain

Restart ComfyUI. There's no requirements.txt, no model download, no heavy dependency - it's pure Python plus a small JS frontend, so this is one of the painless installs.

Where people get burned

The author is Fannovel16 - the same person behind comfyui_controlnet_aux, the ControlNet preprocessor pack everyone runs - but Loopchain is an old, mostly dormant project (last commit December 2023; the README still says "TODO: Detailed explanation"). Community reports from when it was active mention the loop index occasionally skipping, coming back as 0, 0, 2, 3... after a queued run, and the frontend muting nodes mid-loop, which can make widgets misbehave. It's a concept, not a polished product - treat it as an experiment to learn keyframe looping from, not infrastructure for a production pipeline. And note the built-in second of delay between iterations: a 100-frame loop takes over a minute and a half of idle waiting.

CategoryLoopchain

Inputs (6)

NameTypeDefaultDescription
widthINT51264–8192
heightINT51264–8192
batch_sizeINT11–64
num_loopINT1
loop_idxINT0
opt_pipelineoptLOOPCHAIN_PIPELINE

Outputs (2)

NameTypeDescription
LATENTLATENT
INTINT