Nodes/ComfyUI-LivePortraitKJ/LivePortrait Cropper
ComfyUI Node Runs on cloud

LivePortrait Cropper

The node that decides whose face you're animating

By kijai·Created 2 years ago·Updated 2 years ago· 2,199
LivePortrait Cropper
  • pipeline
  • cropper
  • source_image
  • cropped_image
  • crop_info
dsize512
scale2.30
vx_ratio0.000
vy_ratio-0.125
face_index0
face_index_order
rotatetrue

Before LivePortrait can animate a face, it needs to find the face, center it, and compute the geometry that lets the result be pasted back later. That's this node's entire job. It's not the flashy part of the workflow - it's the part that silently decides whether the animation is watchable or garbage.

The confusing thing about the name: LivePortrait Cropper doesn't load any model itself. It takes a cropper from one of the three loader nodes (InsightFace, MediaPipe, or FaceAlignment) and a pipeline from the model loader, and actually runs the detection-and-crop pass on your source image.

What it does under the hood

For every source frame it calls the detector's crop_single_image, which finds the face, computes the affine transform that maps the full frame to a normalized crop, and returns a 256×256 face image. Then - this is the bit that makes it fast - it runs the pipeline's source prep right there: extracting the appearance features, keypoints, and rotation that the Process node would otherwise redo. All of that goes into the crop_info output. You get a head start on inference for free.

The inputs you'll actually touch

  • scale (default 2.3) - how tight the crop is around the face. Bigger = closer. This is the dial for "the head is too small/large in frame."
  • vy_ratio (default -0.125) and vx_ratio (default 0) - shift the crop window up/down and left/right. The -0.125 default biases the crop upward so the forehead has breathing room.
  • rotate (default on) - rotates the crop so a tilted head sits upright. Leave it on unless your source is already perfectly aligned and you want to avoid the extra transform.
  • dsize (default 512) - the internal crop resolution. 512 is plenty for LivePortrait.
  • face_index (default 0) and face_index_order - which face to animate when there are several. The order options (large-small, left-right, distance-from-retarget-face, …) let you say "pick the biggest face" instead of guessing indices. If you're driving a two-person photo, this is where you pick the target.

Outputs

  • cropped_image - the 256×256 normalized face batch, what the pipeline actually consumes.
  • crop_info - the dict holding the per-frame crop transforms, detected landmarks, and the precomputed source features. It wires into LivePortraitProcess, and also into LivePortraitRetargeting when you're doing eye/lip control.

Common issues

  • Black cropped frames with a warning - a source frame where no face was detected. The node logs No face detected on frame X, skipping and pads with a zero image so the batch doesn't break. If every frame is black, the detector isn't finding the face at all (face too small, extreme angle, or the wrong detector for the job - MediaPipe's short-range blazeface misses small faces that the FaceAlignment cropper's blazeface_back_camera catches).
  • The head-zooming effect - a crop that shifts scale between frames, which reads as the face ballooning. It's mostly a source-video stability problem: keep the camera steady, and let the Process node's relative motion modes smooth the rest. People used to pre-stabilize driving video in DaVinci Resolve before this rework; with the current relative modes it's usually not necessary.
  • Wrong face in a group shot - fix with face_index plus a sensible face_index_order, or switch to a detector with a better detection threshold (the InsightFace loader exposes detection_threshold).
CategoryLivePortrait

Inputs (10)

NameTypeDefaultDescription
pipelineLIVEPORTRAITPIPE
cropperLPCROPPER
source_imageIMAGE
dsizeINT51264–2048
scaleFLOAT2.301–4
vx_ratioFLOAT0.000-1–1
vy_ratioFLOAT-0.125-1–1
face_indexINT00–100
face_index_orderCOMBO7 options: large-small, left-right, right-left, top-bottom, bottom-top, small-large, +1
rotateBOOLEANtrue

Outputs (2)

NameTypeDescription
cropped_imageIMAGE
crop_infoCROPINFO