Composite Batch
Reconcile mismatched batch sizes before you composite
- Options
- Composite_Basic
Another node in WJNodes' options-chain family for its ImageCompositeMask_adv compositor (start with Composite_Basic if you haven't seen how these chain together yet). This one solves a specific, very common headache: your background is one batch size, your surface layer is another, and your mask is a third - which frame goes with which?
How it works
batch_mode picks the reconciliation strategy:
auto- matches automatically based on the current batch sizes; the default, and the one to leave alone until you have a reason not to.flatten- collapses multiple images in a batch down into a single image by stacking them via the alpha channel, rather than keeping them as separate batch items.first/last- use just the first or last image in the batch, ignoring the rest.match_back/match_surface/match_mask- force the batch count to match whichever of the three you name, adjusting the others to fit.
batch_start and batch_end let you slice a sub-range out of the batch before any of that reconciliation happens - batch_end set to -1 (the default) means "through the end," so you only need to touch it when you want to cut the batch short.
One detail worth knowing: per this node's own description, its settings default to affecting surface and the mask (MaskMix), not back - same default scope as the rest of this options family. Use Composite_Application_pro if you need batch handling to apply to back instead.
The inputs and outputs that matter
batch_mode(defaultauto) - the reconciliation strategy, from the list above.batch_start(default 0) - start index of the slice.batch_end(default -1) - end index; -1 means to the end of the batch.Options(optional) - the chain to extend.Composite_Basic(output) - the updated chain.
Installing it
Via ComfyUI Manager: search ComfyUI-WJNodes, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/807502278/ComfyUI-WJNodes.git
cd ComfyUI-WJNodes
pip install -r requirements.txt
No unusual dependency for this node.
Common issues & troubleshooting
Composite only uses one frame when you expected a full batch. Check batch_mode - first and last are both legitimate settings for deliberately picking one frame, but they're also easy to leave selected by accident after testing with a single-frame case.
Batch counts still don't line up downstream. auto mode makes a best-effort match, but it can't invent frames that don't exist. If your surface batch is genuinely shorter than your back batch and you need every back frame covered, pick match_back explicitly rather than relying on auto to guess what you want.
Slicing with batch_start/batch_end produces an empty result. Double check the indices against your actual batch size - batch_end accepts -1 for "to the end" but a positive value larger than your batch, or a batch_start past your batch length, will legitimately produce nothing rather than clamping silently.
Changes here don't seem to affect the background layer. That's the default scope again - this node's settings apply to surface and mask by default, not back. Reach for Composite_Application_pro if that's what you actually need.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| batch_mode | COMBO | auto | 7 options: auto, flatten, first, last, match_back, match_surface, +1 |
| batch_start | INT | 00–10000 | — |
| batch_end | INT | -1-1–10000 | — |
| Optionsopt | Composite_Basic | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Composite_Basic | Composite_Basic | — |