Nodes/IAMCCS-nodes/LTX-2 Get Images From Batch ???
ComfyUI Node

LTX-2 Get Images From Batch ???

Slice frames without breaking the 8n+1 rule

By IAMCCS·Created 11 months ago·Updated 8 days ago· 113
LTX-2 Get Images From Batch ???
  • images
  • images
  • count
  • report
  • start_index
  • end_index
modefrom_end
count10
auto_count_modenone
diagnosticsnone
count_rulenone
safe_modenone
count_in10
start_index0
end_index10

A frame-slicer that actually understands LTX-2's length rules

Every video workflow eventually needs to cut frames out of a batch - pull the last 10 frames to use as the next segment's start, grab a range for a reference, drop the first pass's overlap. ComfyUI's core nodes can do some of this, but they don't know anything about LTX-2. This one does, and that's the entire point.

The modes

Five extraction modes, all self-explanatory from the tooltips:

  • from_start / from_end - take count frames from either end (defaults to from_end, count 10). The classic use: take the tail of a completed pass as the anchor for the next segment.
  • range - grab start_index to end_index (end exclusive), when you know exactly which frames you want.
  • drop_start / drop_end - cut frames off either end and keep the rest, for trimming overlap frames you don't want duplicated into the stitched timeline.

The part that makes it an LTX node

Two options exist specifically because LTX's VideoVAE has a hard frame-count rule: video latent lengths must be 1 + 8*x frames. If you feed the VAE 14 frames it doesn't round - it errors or produces garbage. So:

  • count_rule - set to ltx2_round_down or ltx2_nearest and the node forces your requested count down (or to the nearest) valid 1+8x value before slicing. This is the "I asked for 10, got 9, and the encode just worked" switch.
  • auto_count_mode - drive count from a wired count_in (e.g. your overlap_frames from the extension planner) instead of the widget, keeping the loop's overlap and the slice in sync automatically.

There's also a safe_mode for compatibility: native_workflow_safe mimics an older GetImageRangeFromBatch behavior for from_end (images[-count:-1]), so an old workflow keeps producing the same output after you swap nodes.

Outputs

images (the sliced batch), count (what you actually got - handy since rounding may change it), report, and - when diagnostics is set to basic - start_index / end_index so you can see exactly where the cut landed. Wiring the actual count into the next node's frame math is what saves the "count mismatch" headaches in extension loops.

Practical notes

Install is the pack routine: ComfyUI Manager → search "IAMCCS", or clone IAMCCS/IAMCCS-nodes into custom_nodes and restart. No extra deps.

The trap to avoid: count and the 1+8x rule are separate concepts. Turning on count_rule mutates the count you asked for, so if you wire count somewhere expecting exactly 10, you'll get a surprise. That's why the node outputs the real count - read it. And if your extension workflow already has its own rounding upstream, leave count_rule on none; double-rounding two different ways is how you end up with a jump-cut at the seam.

CategoryIAMCCS/LTX-2

Inputs (10)

NameTypeDefaultDescription
imagesIMAGEInput image batch
modeCOMBOfrom_endExtraction mode
countINT101–10000Number of frames to extract (for from_start/from_end)
auto_count_modeCOMBOnoneOptional: auto-drive count from an INT input (e.g. overlap_frames)
diagnosticsCOMBOnoneOptional: expose start/end indices as extra outputs
count_ruleCOMBOnoneOptional: force count to LTX rule (1 + 8*x) for VideoVAE encode
safe_modeCOMBOnoneCompatibility: mimic original GetImageRangeFromBatch behavior for from_end (images[-count:-1])
count_inoptINT101–10000Optional count input (used if auto_count_mode=prefer_input)
start_indexoptINT00–10000Start index for range mode
end_indexoptINT100–10000End index for range mode (exclusive)

Outputs (5)

NameTypeDescription
imagesIMAGE
countINT
reportSTRING
start_indexINT
end_indexINT