Nodes/yiu_comfy_nodes/🔁 Upscale Loop END
ComfyUI Node

🔁 Upscale Loop END

The other half of the loop — stitch the tiles, decide whether to go again

By leizingyiu·Created about a year ago·Updated 3 months ago· 1
🔁 Upscale Loop END
  • yiu_upscale_loop_flow
  • loop_state
  • image_upscaled
  • image
  • help_text

If yiuUpscaleLoopStart is the entry point of the pack's multi-step upscale loop, this is the exit. It's the node you'll rarely think about - you wire it after your upscaler, it takes the upscaled tiles, merges them back into a full image, and either feeds the next iteration or hands you the finished result. That's the entire job, and the "END" in its name is literal.

You only need it if you're building the loop by hand. The minimal wiring: START's image → your upscaler → this node's image_upscaled, plus the two loop wires (flow and loop_state) between START and END. The pack ships an example workflow so you don't have to reconstruct the pattern from scratch.

How it works

END is where the tiling pays off and the loop converges. It takes the upscaled tile batch, stitches it back to a full image using the rows/cols/overlap layout that START computed, and blends the overlapping seams with a linear weight ramp - so the overlap zones crossfade instead of showing a hard seam line. Then it advances the step counter. If there are more steps to go, it recurses the loop with the merged image as the next iteration's input; if not, it returns the final image.

The recursive re-run is powered by a hidden helper node (.internal/while_loop_end) that rebuilds the subgraph between START and END for each pass. You never touch that node - it's hidden from the menu and this is one of the few places you'll meet it, inside a saved workflow.

Inputs

  • yiu_upscale_loop_flow - from START.flow. The loop driver wire.
  • loop_state - from START.loop_state. Carries the step index, totals, and tiling layout.
  • image_upscaled - the output of your upscaler. Note this is still the tile batch, not a full image; END does the stitching.

Output

  • image - the final stitched full image once the loop completes, plus the pack's usual help_text string.

Installing it

Part of yiu_comfy_nodes by leizingyiu. ComfyUI Manager → search yiu_comfy_nodes, or:

cd ComfyUI/custom_nodes
git clone https://github.com/leizingyiu/yiu_comfy_nodes

Restart after. No extra dependencies; the upscaler between START and END is your choice and yours to install.

Where people get burned

  • Same wiring trap as START. Miss either the flow or loop_state connection and the loop can't advance - it either stalls or outputs garbage after one pass. Both wires, every time.
  • Your upscaler must preserve the tile layout. END stitches assuming the tiles came back in the same order and roughly the same size. If your upscaler crops tiles or reorders the batch, the stitch misaligns. Feed it the batch as-is.
  • Tiles count mismatch errors. END validates that the batch size is divisible by rows×cols and raises a clear error otherwise - a good diagnostic, not a crash.
  • Previews die on huge outputs. For >200 megapixel results the pack deliberately warns you (a toast appears): ComfyUI's preview can't show it, so connect a Save node instead of a Preview node.
Categoryyiu_nodes

Inputs (3)

NameTypeDefaultDescription
yiu_upscale_loop_flowFLOW_CONTROL
loop_stateYIU_UPSCALE_LOOP_STATE
image_upscaledIMAGE

Outputs (2)

NameTypeDescription
imageIMAGE
help_textSTRING