SEGS to Face Crop Data
Pull One Face Out of a SEGS Stream Without the Crop Math
- segs
- IMAGE
- CROP_DATA
If you've ever built a face-swap or face-fix graph with Impact Pack, you know the annoying middle step: a detector hands you a pile of SEGS, and suddenly you're re-implementing crop-and-paste yourself. This node cuts through that. It takes a SEGS stream and an index, and hands you the cropped face image plus the CROP_DATA you need to paste it back where it came from.
It's part of ComfyUI-off-suite, Off-Live's small personal pack of face-crop utilities. Nothing in the pack is famous, and this node is the sort of thing you'd otherwise hand-roll with a few ImageCrop nodes. Hand-rolled is fine. This is just shorter.
What you plug in
- segs - any SEGS output: Impact Pack's FaceDetector,
Detector (SEGS), a SAM pipeline, whatever. This node doesn't care what produced it. - face_index - which face to pull out,
0being the first detection. Defaults to 0.
What comes out
Two outputs, and they're meant to be used together:
- IMAGE - the actual cropped face, exactly as Impact Pack's detector cropped it.
- CROP_DATA - the crop region (the bounding box in the original image), which is the secret sauce. Feed this to a paste-back node and the face goes home.
The pairing partner is Paste Face Segment to Image from the same pack: it takes crop_data, the original image, and the crop, and composites the (edited) face back onto the original. That's the classic "crop a face → run a detail pass on it at high resolution → paste it back" loop that Impact Pack's FaceDetailer makes automatic, except here you control every step yourself.
The gotcha that will bite you
face_index is an index into the SEGS list, and nothing stops you from picking one that doesn't exist. Ask for face 3 in a two-face frame and you'll get an IndexError and a dead queue. If your detector sometimes finds more faces than expected, clamp the index upstream or run a quick SEGS count first.
The other thing worth knowing: the cropped IMAGE is whatever the detector cropped - it is not square and not resized to a multiple of 8. If you're sending it straight to a VAE or an img2img sampler, run it through Image Resize Fit or Image Crop Fit from this same pack first, or you'll hit dimension complaints downstream.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Off-Live/ComfyUI-off-suite
# or: ComfyUI Manager → search "ComfyUI-off-suite"
No requirements to pip-install; the pack uses only what ComfyUI ships (numpy, Pillow, OpenCV). The actual dependency is Impact Pack, because SEGS is Impact Pack's data type - without it installed, this node has nothing to feed on. Like the rest of off-suite, don't expect active maintenance; the repo's been quiet since mid-2024, but for a utility this small that's rarely a problem.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| segs | SEGS | — | |
| face_index | INT | 0 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| CROP_DATA | CROP_DATA | — |