LoopEnd_IMAGE
LoopEnd_IMAGE Stores the Next Frame
- send_to_next_loop
- loop
LoopEnd_IMAGE is the back half of the pack's feedback rig, and it does the one job that makes the whole "loop" work: it takes the image your pipeline produced and stuffs it into the shared LOOP object for the next iteration. It has no outputs at all - it's an output node whose entire effect is a side effect, writing state that LoopStart_IMAGE will read at the top of the next run.
Concretely, its run method does loop.next = send_to_next_loop and returns nothing. That's the whole implementation. The image you hand it gets stored as an attribute on the LOOP token, which is just the Loop node's own object passed around by reference. On the next execution, LoopStart_IMAGE sees loop.next is set and uses that image instead of the initial frame, and because the stored image's identity changes, the graph's changed-check fires and the chain re-runs. The loop is: produce → store → detect change → produce again.
Inputs
- send_to_next_loop - the
IMAGEto carry forward. In the canonical DragNUWA rig this is the last frame of the previous generation, pulled off with Get Last Image - that's the handoff from "one clip ends" to "next clip begins." - loop - the
LOOPtoken from the Loop node, the state carrier.
How you wire it
The loop needs to be a physical cycle in the graph, which ComfyUI won't allow directly, so the rig routes the LOOP token around the outside: Loop → LoopStart_IMAGE → your generation chain → Get Last Image → LoopEnd_IMAGE → (back to the same loop token). The token is the only thing that loops; the image rides inside it. If that sounds convoluted, it is - it's a workaround for the fact that the graph is a DAG.
The caveats, stated plainly
Since LoopEnd_IMAGE only ever writes, it never clears what it wrote. A stale next from a prior execution can leak into a fresh run, and the pack gives you no reset node to clear it - you manage that by reloading the workflow or being careful about what's connected. It also has no notion of "how many times," so ending the loop means stopping the queue by hand. For a one-shot chain of two or three drags, you'll honestly get more predictable results wiring Get Last Image straight into a second DragNUWA Run and skipping the loop entirely. The Loop family is for when you want genuinely open-ended iteration and are willing to babysit it. As loop implementations go it's a tour de force of working around the engine - as loop ergonomics go, it's vintage 2024 hackery.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| send_to_next_loop | IMAGE | — | |
| loop | LOOP | — |
Outputs (0)
No outputs