Nodes/DJZ-Nodes/Batch Offset
ComfyUI Node

Batch Offset

Rotate your frames by a step, wrap and all

By MushroomFleet·Created 2 years ago·Updated 5 months ago· 78
Batch Offset
  • images
  • IMAGE
offset-1

BatchOffset is the smallest idea in the DJZ batch family: take a batch of images and shift their order by a fixed number of positions, wrapping around the end. It's one images input, one offset integer (default −1, range −100 to 100), and one IMAGE output of the same shape. That's the entire node, and it's genuinely more useful than it sounds.

The mechanism is a circular shift. With offset = -1, frame 1 moves to the last position, frame 2 becomes frame 1, and everything shifts back one - with the batch wrapping, so nothing is dropped. Positive values shift the other direction. Offset equal to the batch size (or its negative) is a no-op, which is your free "did I break it" sanity check. It needs a real multi-frame batch; feed it a single image and it passes through with a warning.

Why would you want this? Three honest reasons. Timing fix: you generated a loop and the loop starts on the wrong frame - a one-frame offset makes the seam invisible, turning a "jump cut" into a "loop." Rhythm: shifting a two-element batch back and forth creates a subtle frame repeat/backward play, which is a quick way to fake motion-speed variation without regenerating anything. Alignment: if you're combining two generated batches that should be frame-aligned but one is off by a step (a common artifact of how some video models slice their output), offsetting one batch fixes the pairing.

The trap that will actually bite: offset wraps, it doesn't clamp. Offset −1 on a 2-frame batch just swaps the two frames; offset −1 on a 300-frame batch looks like nothing happened unless you're comparing frame 299 against frame 0. And because it wraps, an "off-by-one" mistake is silent - the node never errors, it just gives you a shifted sequence. If your output looks unchanged, check whether your offset is a multiple of the batch size before assuming the node is broken.

Honest scope check: this is a utility, not a feature. It's the kind of node you install the whole DJZ pack for and then use twice a month, but both of those times it saves you from rebuilding a workflow or hand-reordering frames in an editor. It pairs naturally with its batch siblings - BatchThief (extract a range), BatchRangeInsert (splice new frames in) - for a cut-and-reorder toolkit that stays fully inside the graph.

No models, no downloads, pure tensor slicing. Install: ComfyUI Manager → "DJZ-Nodes", or cd ComfyUI/custom_nodes && git clone https://github.com/MushroomFleet/DJZ-Nodes && pip install -r requirements.txt. Zero VRAM pressure beyond the tensors you already have.

Categoryimage/batch

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
offsetINT-1-100–100

Outputs (1)

NameTypeDescription
IMAGEIMAGE