Nodes/Mickmumpitz-Nodes/Iteration Switch
ComfyUI Node

Iteration Switch

Only process the video after the first pass

By mickmumpitz·Created 8 months ago·Updated 9 days ago· 47
Iteration Switch
  • original
  • processed
  • image

Some processing should only happen after the first iteration of a video. Color correction, sharpening, a detail pass - running it on the very first frames is either pointless or actively harmful, because the first pass is the raw material everything else builds on. Iteration Switch is the gate that handles this: it passes the original image on iteration 0 and the processed image on every iteration after.

It's a tiny node with a very specific job, and it sits in the pack's video/iteration family - the set of nodes that make multi-pass video generation behave.

How it works

The node has two image inputs, original and processed, and one output, image. The trick is the hidden iteration input: ComfyUI hands it the current iteration number automatically (the pack's iterative machinery tracks this). The logic is a single if:

  • iteration 0 → output original (no processing).
  • iteration 1+ → output processed.

So you wire the raw, untouched frames into original and the output of your processing chain (say, Batch Color Corrector or an upscaler) into processed. On the first pass the video gets the raw frames; from the second pass on, it gets the treated ones. That's the whole mechanism - no widgets beyond the two image inputs, no settings to forget.

Where it fits

The intended use case is spelled out in the source: "conditionally apply processing (e.g. color correction) only after the first iteration." In the pack's iterative video loops, later iterations carry forward overlapping start frames from the previous pass, so they're already "used" footage - applying a grade to them keeps the whole timeline consistent without distorting the initial generation. Combined with Batch Color Corrector and a FrameAccumulator, you get a loop where the first pass is clean, everything after is graded, and the frames accumulate into one coherent video.

It also plays with the pack's broader iteration nodes: Iter String Selector and Iter Seed Batch handle the per-iteration prompt and seed, and this handles the per-iteration image path. They all share that hidden iteration context, so they stay in lockstep without you threading a counter around manually.

Installing

Part of Mickmumpitz-Nodes - ComfyUI Manager, search "Mickmumpitz", install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/mickmumpitz/ComfyUI-Mickmumpitz-Nodes

Light deps only (numpy, Pillow, opencv-python), no downloads.

Gotchas

If your workflow isn't going through the pack's iteration machinery, the hidden iteration input defaults to 0, which means every run outputs original - the processed branch never fires. Don't fight it; this node assumes you're inside a pack-managed loop. And since the switch only chooses between the two wired branches, both inputs must be connected - leaving processed empty gives you a silent fallback to original, which is exactly backwards from what you want if you were expecting the processed path.

CategoryMickmumpitz/video/iteration

Inputs (2)

NameTypeDefaultDescription
originalIMAGE
processedIMAGE

Outputs (1)

NameTypeDescription
imageIMAGE