Extract Parts Batch 2 v5.1.0
Keep the part, black out the rest — the non-cropping version of part extraction
- batch_images
- batch_segs
- batch_secondaries
- IMAGE
- IMAGE
tri3d-extract-parts-batch2 looks identical to tri3d-extract-parts-batch at a glance - same inputs, same two image outputs, same class booleans. The difference is the whole point: instead of cutting a tight bounding-box crop around the selected garment parts, this one keeps the full image and zeroes out everything outside the selected classes. The "2" in the name is not a version bump; it's a different operation that the sibling node can't do.
What it does
Same three image inputs as its sibling: batch_images (real photos), batch_segs (the ATR segmentation maps), and batch_secondaries (a paired second image set the same treatment is applied to). Plus margin and the same eighteen ATR-class booleans, hands defaulting to on.
The difference is in the two outputs:
- IMAGE 1 - the full image multiplied by the selected-class mask. Everything that isn't the chosen garment/body part becomes black; the part itself stays in place with full resolution and position intact. No resizing to a crop, no padding, no geometry change.
- IMAGE 2 - the inverted mask: white everywhere except the selected parts, black on them. It's a "keep everything else" mask, which is exactly what you need for compositing steps where the part must be protected.
That pair is the whole value. You get the part extracted in context and the inverse mask in one go, aligned to the same frame because neither output moves the pixels.
When batch2 beats batch
Use the bounding-box version when you want a tight, re-framed patch to feed a model (a garment closeup for a VTON pass). Use batch2 when position matters - when you're masking for inpainting, compositing back onto the original frame, or need the inverse mask anyway. Because output 1 keeps coordinates, you can swap content in and out of the exact same location without an alignment step, which is the common failure mode of crop-and-paste pipelines.
Same caveats as the family: exact color matching means it only works with this pack's ATR output, and if a class isn't present you get a black frame rather than an error.
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 - pure pixel logic on the ATR maps.
Troubleshooting
- Output is all black - the selected class wasn't found in that image, so the mask multiplied to nothing. Console shows the class counts; check whether the part is actually visible.
- Inverted mask looks wrong - remember output 2 is deliberately the inverse of the selection. If you wanted a plain mask of the part, that's
tri3d-extract-masks-batch's job. - Confusing outputs with the sibling node - if your downstream expects a small crop and you're feeding it a full-frame image, you grabbed the wrong node; the two are easy to mix up in a busy graph.
A quiet utility, but the "extract without losing the frame + give me the inverse mask" combo is exactly what a lot of garment compositing actually wants.
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 | — |