Extract Parts Batch v5.1.0
Cut garment parts out of a batch — the workhorse of the VTON pipeline
- batch_images
- batch_segs
- batch_secondaries
- IMAGE
- IMAGE
This is the node the whole pack is really built around. Where tri3d-extract-masks-batch gives you a mask of the garment, tri3d-extract-parts-batch gives you the garment itself - a cropped patch of the original image, trimmed to the bounding box of whatever ATR class you selected, with a margin. In TRI3D's virtual try-on flows this is how you lift a sleeve, a torso, a dress, or a pair of hands out of a source image and hand it to the next stage.
What it does
Three image inputs, which is the part that confuses people:
batch_images- the real photos/generations you want to crop from.batch_segs- the matching ATR segmentation maps (fromtri3d-atr-parse-batch).batch_secondaries- a second image set the same crop gets applied to. This is the trick: whatever box you cut frombatch_images, it cuts the identical region frombatch_secondaries. In practicebatch_secondariesis usually the same images (so you get the crop twice) or a paired/processed version - the node is built for piping one crop into two downstream paths at once.
Then margin (pixels to pad the crop, default 15) and the same eighteen ATR-class booleans as the masks node (hands default on, everything else off).
For each selected class it finds the contours of that class's pixels in the segmentation, takes the bounding box of all contours, pads it by margin, and crops that region out of both batch_images and batch_secondaries. Everything is resized to the batch's max crop dimensions so it stacks cleanly, and the two outputs come back as a pair:
- IMAGE 1 - the crops from
batch_images - IMAGE 2 - the matching crops from
batch_secondaries
If a class isn't found in an image, you get a small black 10×10 patch instead of an error - be aware of that, because it'll silently poison your batch if you don't notice.
Why the two outputs matter
TRI3D's own sample workflows use this to feed "extracted part" and "secondary" into parallel processing - the crop from the model shot and the crop from the garment shot, kept aligned because they share a bounding box. If you don't need that, just wire the first output and ignore the second. Nothing forces you to use the pairing.
Installing
ComfyUI Manager (search "tri3d"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/TRI3D-LC/tri3d-comfyui-nodes
Restart, install requirements (pip install -r custom_nodes/tri3d-comfyui-nodes/requirements.txt). No model downloads for this node - it's contour logic on top of the ATR output.
Troubleshooting
- Black 10×10 patches in your batch - that class wasn't found in one or more images (missing hands is common when the pose hides them). Check the console output, or accept that a few slots are empty.
- Crops bigger than expected -
marginadds to both sides; the default 15px is modest, but if you're seeing neighbors bleed in, drop it. - Empty selection - if every boolean is off, nothing gets cropped. Turn on at least the classes you care about.
This is the one node in the pack I'd call genuinely essential for VTON work - masks tell you where a garment is, but this is how you actually get your hands on it.
Inputs (22)
| Name | Type | Default | Description |
|---|---|---|---|
| batch_images | IMAGE | — | |
| batch_segs | IMAGE | — | |
| batch_secondaries | IMAGE | — | |
| margin | INT | 15 | — |
| right_leg | BOOLEAN | false | — |
| right_hand | BOOLEAN | true | — |
| head | BOOLEAN | false | — |
| hair | BOOLEAN | false | — |
| left_shoe | BOOLEAN | false | — |
| bag | BOOLEAN | false | — |
| background | BOOLEAN | false | — |
| dress | BOOLEAN | false | — |
| left_leg | BOOLEAN | false | — |
| right_shoe | BOOLEAN | false | — |
| left_hand | BOOLEAN | true | — |
| upper_garment | BOOLEAN | false | — |
| lower_garment | BOOLEAN | false | — |
| belt | BOOLEAN | false | — |
| skirt | BOOLEAN | false | — |
| hat | BOOLEAN | false | — |
| sunglasses | BOOLEAN | false | — |
| scarf | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| IMAGE | IMAGE | — |