SelectBatch paragraph
Grab a contiguous slice of a batch by start index and length
- images
- masks
- select_img
- exclude_img
- select_mask
- exclude_mask
An image or mask batch in ComfyUI is just frames stacked on top of each other, and a good chunk of any video or multi-image workflow is slicing that stack down to the part you actually care about. SelectBatch_paragraph does exactly one thing: "starting at frame Item, give me length frames." No fancy indexing syntax, no separate node to compute ranges - you set two numbers and get a chunk back.
Quick context on where this comes from: WJNodes is a one-person grab-bag pack from a GitHub user going by 807502278. There's no company behind it, no marketing push, and the README's own framing is refreshingly blunt - "a simple node package that I use myself." It doesn't show up in ComfyUI discussion anywhere I could find, which tracks: this is a personal toolbox someone made public, not a pack with a following. That's not a knock on the node itself, though - the batch-slicing tools in here do a real job, they're just quietly built rather than promoted.
How it works
Item is the start frame, 0-indexed like everything in ComfyUI. It also accepts negative numbers, which count from the end of the batch instead - set Item to -8 and you're starting 8 frames from the tail without doing the subtraction yourself. length is how many frames you take from there, and it too can go negative, which flips the direction: instead of counting forward from Item, it counts backward. Between the two, you can slice forward, slice backward, or lift the last N frames of a clip in one node.
The interesting part is what happens when your requested slice runs off either end of the batch - extend gives you five behaviors: no_extend just stops short and gives you fewer frames than asked, start_extend/end_extend repeat the edge frame to pad the slice up to length, loop wraps around and keeps pulling frames from the start, and loop_mirror bounces back and forth instead of hard-cutting the loop (useful if a repeated wraparound would create a visible jump). reversal_batch reverses the order of the selected frames - and padding is applied after the reversal, so if you want the padded frames at the front instead of the back, flip this on rather than trying to reverse your input upstream.
One thing worth knowing: images and masks are computed independently, and their batch sizes don't have to match. Feed a 40-frame image batch and a 12-frame mask batch and each gets sliced on its own terms - you're not forced to pre-align them.
The inputs and outputs that matter
Item(int, default 0) - starting frame, negative counts from the end.length(int, default 1) - how many frames, negative counts backward fromItem.extend- padding behavior when the slice overruns:no_extend,start_extend,end_extend,loop,loop_mirror.images/masks(optional) - feed whichever you have; you don't need both.select_img/select_mask- your slice, wire this to whatever comes next.exclude_img/exclude_mask- everything not selected, handy if you want to process the rest of the batch differently.
How to install it
Through ComfyUI Manager: search "ComfyUI-WJNodes," install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/807502278/ComfyUI-WJNodes
then restart ComfyUI. The README lists an optional pip install -r requirements.txt, but most of what the pack needs already ships with ComfyUI. Nothing heavy to download for this specific node - the pack's README mentions optional model downloads (torchvision, EasyOCR, SAM2), but those belong to other nodes in WJNodes, not this one.
Common issues & troubleshooting
The README here is just a node list - no wiki, no examples - so the real advice is: test the five extend modes on a short batch before trusting them on a long video. They genuinely produce different results and are easy to mix up on a first pass, especially loop vs loop_mirror.
If your output comes back shorter than you expected, double check length - since it accepts negative values with a different meaning (count backward instead of forward), it's an easy field to misread once. And because this is a one-person pack maintained on the side, don't expect a fast turnaround if something's genuinely broken - read the node's own tooltip carefully before assuming a bug.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| Item | INT | 0-4096–4096 | — |
| length | INT | 1-4096–4096 | — |
| extend | COMBO | 5 options: no_extend, start_extend, end_extend, loop, loop_mirror | |
| reversal_batch | BOOLEAN | false | — |
| imagesopt | IMAGE | — | |
| masksopt | MASK | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| select_img | IMAGE | — |
| exclude_img | IMAGE | — |
| select_mask | MASK | — |
| exclude_mask | MASK | — |