Combine two BBOX layouts into one
Merge Two VACE Layout Tracks Into One Clip
- images_a
- images_b
- IMAGE
Two objects, two boxes, one layout video. That's the entire reason this node exists.
VACE's layout control takes a single stream of white-canvas frames with colored outlines, and the sibling node in this pack - VideoLayoutTrackAnnotatorNode - tracks one box per run. So if your shot has two things moving and you want both controlled, you run the tracker twice (once per object, one box each) and end up with two layout clips that each describe one region. VACE wants one stream. This node, "Combine two BBOX layouts into one," is the glue that merges them.
What it actually does
Don't overthink the mechanism, because it's refreshingly simple: pure NumPy, no models, no GPU. For each frame pair it treats any pixel in the second layout that isn't pure white as "ink" and pastes it on top of the first layout's frame. Since layout frames are white (255) canvases with colored outlines, the net effect is exactly "draw B's boxes on top of A's canvas."
The one decision the code makes is order: B wins wherever the two overlap. That's it.
Inputs and output
- images_a (IMAGE, required) - the base layout track.
- images_b (IMAGE, required) - the track pasted on top.
- Output: IMAGE, same frame count as the inputs, ready for VACE's layout control.
Both inputs must be the same resolution and frame count - it zips them frame-by-frame, so a shape mismatch throws. Feed it the two outputs from the tracking node and you're done.
Installation
Same pack, same one-time setup: search "comfyui_vace_preprocessors" in ComfyUI Manager, or
cd ComfyUI/custom_nodes
git clone https://github.com/SamTyurenkov/comfyui-vace-preprocessors
pip install -r requirements.txt
then restart. One nice property here: this node has zero model dependencies of its own. If you only want the combine, you don't need the SAM2/GroundingDINO/U2-Net downloads for it - you just need the tracks it merges, which were made by the tracking node upstream. That's where the model-heavy install lives.
Gotchas
- White is transparent. If a track was drawn in pure white, its pixels vanish in the composite. In practice the contours are colored, so this is theoretical - but keep it in mind if you've tweaked colors.
- Order matters. The second input wins where tracks overlap. Swap the inputs if you want the other object's box on top.
- It's honest glue. A ten-line compositor wearing a node costume, but that's a feature: reaching for this names the intent and saves you rebuilding the same
where()logic in a mask-composite chain every time you need it.
One last take: this pack is a niche, near-zero-traffic utility, and this is the thin half of it. The impressive part is the tracking node that makes the two inputs. But when you need to fuse two layout tracks, this is the exact tool - no more, no less.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| images_a | IMAGE | — | |
| images_b | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |