LTX-2 Get Images From Batch ???
Slice frames without breaking the 8n+1 rule
- images
- images
- count
- report
- start_index
- end_index
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- takecountframes from either end (defaults tofrom_end, count 10). The classic use: take the tail of a completed pass as the anchor for the next segment.range- grabstart_indextoend_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 toltx2_round_downorltx2_nearestand the node forces your requested count down (or to the nearest) valid1+8xvalue before slicing. This is the "I asked for 10, got 9, and the encode just worked" switch.auto_count_mode- drivecountfrom a wiredcount_in(e.g. youroverlap_framesfrom 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.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | Input image batch | |
| mode | COMBO | from_end | Extraction mode |
| count | INT | 101–10000 | Number of frames to extract (for from_start/from_end) |
| auto_count_mode | COMBO | none | Optional: auto-drive count from an INT input (e.g. overlap_frames) |
| diagnostics | COMBO | none | Optional: expose start/end indices as extra outputs |
| count_rule | COMBO | none | Optional: force count to LTX rule (1 + 8*x) for VideoVAE encode |
| safe_mode | COMBO | none | Compatibility: mimic original GetImageRangeFromBatch behavior for from_end (images[-count:-1]) |
| count_inopt | INT | 101–10000 | Optional count input (used if auto_count_mode=prefer_input) |
| start_indexopt | INT | 00–10000 | Start index for range mode |
| end_indexopt | INT | 100–10000 | End index for range mode (exclusive) |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| count | INT | — |
| report | STRING | — |
| start_index | INT | — |
| end_index | INT | — |