Nodes/tri3d-comfyui-nodes/Extract Parts Batch v5.1.0
ComfyUI Node

Extract Parts Batch v5.1.0

Cut garment parts out of a batch — the workhorse of the VTON pipeline

By TRI3D-LC·Created 3 years ago·Updated about a year ago· 27
Extract Parts Batch v5.1.0
  • batch_images
  • batch_segs
  • batch_secondaries
  • IMAGE
  • IMAGE
margin15
right_legfalse
right_handtrue
headfalse
hairfalse
left_shoefalse
bagfalse
backgroundfalse
dressfalse
left_legfalse
right_shoefalse
left_handtrue
upper_garmentfalse
lower_garmentfalse
beltfalse
skirtfalse
hatfalse
sunglassesfalse
scarffalse

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 (from tri3d-atr-parse-batch).
  • batch_secondaries - a second image set the same crop gets applied to. This is the trick: whatever box you cut from batch_images, it cuts the identical region from batch_secondaries. In practice batch_secondaries is 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 - margin adds 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.

CategoryTRI3D

Inputs (22)

NameTypeDefaultDescription
batch_imagesIMAGE
batch_segsIMAGE
batch_secondariesIMAGE
marginINT15
right_legBOOLEANfalse
right_handBOOLEANtrue
headBOOLEANfalse
hairBOOLEANfalse
left_shoeBOOLEANfalse
bagBOOLEANfalse
backgroundBOOLEANfalse
dressBOOLEANfalse
left_legBOOLEANfalse
right_shoeBOOLEANfalse
left_handBOOLEANtrue
upper_garmentBOOLEANfalse
lower_garmentBOOLEANfalse
beltBOOLEANfalse
skirtBOOLEANfalse
hatBOOLEANfalse
sunglassesBOOLEANfalse
scarfBOOLEANfalse

Outputs (2)

NameTypeDescription
IMAGEIMAGE
IMAGEIMAGE