Nodes/Immac's Tools/Skip Every Nth Image
ComfyUI Node

Skip Every Nth Image

Thin a frame batch and keep receipts

By Immac·Created 11 months ago·Updated 6 months ago· 0
Skip Every Nth Image
  • images
  • images
  • removed indices
n2

Skip Every Nth Image does exactly what it says: it walks a batch of images and drops every nth one, keeping the rest in their original order. Batch in, thinned batch out - plus a list of which positions got removed, which is the part that makes this more than a blunt delete button.

The two inputs are images (any batch - a torch tensor with a batch dimension or a plain list/tuple of frames) and n (INT, default 2). Set n = 2 and every second frame goes; n = 3 takes every third. The outputs are images (the kept batch) and removed indices (the zero-based positions that were cut). The node handles both tensor batches and Python lists transparently, and it's friendly about degenerate input: n ≤ 0 returns an empty batch and marks every index as removed rather than crashing.

Where does frame-thinning actually earn its keep? Three spots, all real. In video work, a 120-frame clip is a lot of sampling time - thin it to every 4th frame, run a quick pass to sanity-check motion and composition, then go back to full frames for the final. For i2v workflows, a deliberately sparse frame set can be the cheap way to preview an animation direction before committing hours to the full sequence. And in batch generation, it's a way to build a hold-out set: keep the full batch for saving, wire the thinned one into a preview or a slow analysis pass, and use removed indices to know exactly which frames you're not looking at.

One honest note: this is a small, single-purpose node from a personal-use pack, and it shows its age in polish - the category is Example and the tooltip only tells you about the empty-output case. But for the one job it does, it's complete and correct.

Installing it

Ships in ComfyUI-ImmacTools by Immac - MIT-licensed, dependency-free beyond ComfyUI's own torch, no model files. Install via ComfyUI Manager by repo URL or:

cd ComfyUI/custom_nodes
git clone https://github.com/Immac/ComfyUI-ImmacTools

Restart ComfyUI and search "Skip Every Nth" under the Example category. The pack needs a current ComfyUI (newer ComfyExtension API) to register.

Common issues

The usual complaint is off-by-one expectations about the indices: they're zero-based, and they count every nth item - with n = 2 that's positions 1, 3, 5, … . If a downstream node wants to recombine, feed it the removed indices output rather than re-deriving them by hand. And remember the thinning is done on the batch as given - if your upstream node produces frames out of order, the indices reflect that order, so count on it being stable for the same seed and workflow.

CategoryExample

Inputs (2)

NameTypeDefaultDescription
images*Batch of images/frames (list or tensor).
nINT2Skip every nth image; n<=0 yields empty output.

Outputs (2)

NameTypeDescription
images*
removed indices*