Nodes/JNComfy/Face Crop
ComfyUI Node

Face Crop

Pull faces out of an image, one bounding box at a time

By jn-jairo·Created 2 years ago·Updated 2 years ago· 5
Face Crop
  • image
  • IMAGE
  • AREA_ARRAY
facedetection

You want to do something specifically to the faces in an image - restore one, upscale one, feed one into a separate pass - without touching the rest of the picture. JN_FaceCrop is the "find the faces and cut them out" step of that pipeline: run a detector over an image, get back the cropped faces plus exactly where each one came from.

It's part of JNComfy (jn-jairo/jn_comfyui), a one-person pack that covers a surprisingly wide spread of ground - audio, face restoration, sampling tweaks, workflow logic - with almost no presence in the wider community. There's no buzz around it, no threads, nothing. That's not a knock on the code; it just means you're on your own for troubleshooting beyond what's in the README and what the schema tells you, rather than being able to lean on a Discord full of people who've hit the same wall.

How it works

facedetection picks which detector backend runs the actual face-finding: retinaface_resnet50, retinaface_mobile0.25, YOLOv5l, or YOLOv5n. These aren't JNComfy's own models - they're the standard detector zoo from facexlib, the same library that mav-rik/facerestore_cf uses under the hood (the JNComfy README credits it directly as a reference for the pack's face-restore nodes). RetinaFace ResNet50 is the accurate, slower option; RetinaFace Mobile0.25 trades accuracy for speed; the two YOLOv5 variants (large and nano) are a different detection approach with the same speed-vs-accuracy split. Start with retinaface_resnet50 if you're not sure - switch down only if you're processing a lot of images and detection speed actually matters.

Detection produces two things: the cropped face image itself, and an AREA_ARRAY - one bounding box per face found, in JNComfy's own "area" format, the same one used by the pack's JN_Area* nodes. That array is what lets you paste a processed face back into the original image afterward (with something like JN_ImageUncrop, not covered here but named right next to face-restore in the README) - the crop alone would just leave you with a floating face and nowhere to put it back.

Worth comparing to Impact Pack's FaceDetailer or ADetailer, which most people reach for first: those bundle detect-mask-inpaint into one automatic node. JN_FaceCrop is deliberately not that - it only does the detect-and-crop step, leaving restoration, upscaling, and pasting back as separate nodes you assemble yourself. More LEGO, less magic button - more control, more setup.

The inputs and outputs that matter

  • image (required, IMAGE) - what to scan for faces.
  • facedetection (required, one of the four backends above) - the only real decision you make on this node.
  • Outputs: IMAGE (the cropped face) and AREA_ARRAY (where it came from, for pasting back later).

There are no optional inputs - this node does one job.

Installing it

ComfyUI Manager: search "JNComfy". Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/jn-jairo/jn_comfyui

Restart ComfyUI. The node itself needs nothing extra, but the detector weights are not bundled - like facexlib-based tools generally, they auto-download (roughly 100MB-class files) from their model hub the first time you actually run detection. That means the first run needs a working internet connection; if you're on an offline box, this step will fail until the weights are pre-seeded.

Common issues & troubleshooting

A face doesn't get detected. Faster/smaller detectors (YOLOv5n, retinaface_mobile0.25) miss more than the bigger ones. If a face you can clearly see isn't showing up, swap to retinaface_resnet50 before assuming something else is wrong.

First run hangs or errors out. That's almost always the weight download stalling or failing, not a bug in the node - check your connection and the console log.

Multiple faces, one output. AREA_ARRAY covers however many faces were actually found - if a downstream node expects exactly one face, you'll need to pick one out with an item-selection node from the pack's Process family rather than assuming there's only ever one entry.

CategoryJN/Image/Face

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
facedetectionCOMBO4 options: retinaface_resnet50, retinaface_mobile0.25, YOLOv5l, YOLOv5n

Outputs (2)

NameTypeDescription
IMAGEIMAGE
AREA_ARRAYARRAY