Nodes/comfyui-face-beauty/Face Paste Back
ComfyUI Node

Face Paste Back

Puts your improved faces back on the right heads, seam-free

By FeiJiu518·Created 4 months ago·Updated 4 months ago· 0
Face Paste Back
  • original_image
  • processed_faces
  • crop_data
  • image
feather16

"The reverse of cropping, done so nobody sees the seam"

If Face Crop Square is the "out" half of this pack, Face Paste Back is the "back in" half. You've cropped every face to a square, run each one through your own beautification step, and now you need them stitched onto the original image so the fix doesn't look like a sticker slapped over a photo. That's this node's entire job, and it does it with a feathered edge that hides the border.

It's the same loop FaceDetailer automates in one node - detect, crop, refine, paste - just with your own refinement in the middle. This is the closing bracket that makes the custom pipeline work.

How it works

Four inputs, one of which you'll actually think about:

  • original_image - the same image you fed Face Crop Square.
  • processed_faces - this input expects a list, so wire it straight to face_crops from Face Crop Square. Each processed face is matched to a crop by position.
  • crop_data - the FACE_CROP_DATA blob Face Crop Square outputs. The paste coordinates live inside it; it's a private contract between the two nodes.
  • feather - edge feather width in pixels, default 16, range 0–128, step 2. This is the knob you'll tune.

Mechanically it walks the crops in order and, for each one: resizes your processed face back to the crop's square size with LANCZOS, strips off the black padding Face Crop Square added, builds a soft mask - a white inner rectangle blurred by about feather × 0.6 pixels - and pastes it at the stored coordinates. Feathering is the classic trick from the inpainting playbook: a hard mask leaves a visible border, a soft one melts the edit into the surroundings. Everything outside the pasted region stays bit-identical to the original, which is the property that makes this whole approach worth it.

The traps, because there are three

  • Order is a contract, not a convenience. Face #3 in the list gets pasted onto crop #3's head. If anything upstream reorders, filters, or merges the face_crops list, you get improved face #2 on head #3 - or worse, nobody noticing until the image's done. Keep the list untouched between crop and paste.
  • Fewer faces out than in fails silently. If your refinement chain dropped a face (say a filter node ate one), the paste loop just stops when it runs out and leaves that face unrepaired. No warning. Count your crops.
  • It assumes your refinement kept the shape. The processed face is resized back to the crop's square dimensions, so feed it squares. A non-square output gets squashed. And if you hand it a face from somewhere other than Face Crop Square, there's no crop_data and nothing to paste - this node only speaks the pack's own format.

Feather behavior is the thing to sanity-check first when results look off. Too low and you'll see a hard edge on the pasted face; too high and the face bleeds into the surrounding pixels and picks up a ghostly halo. 16 is a fine starting point; move it by steps of 2.

Installing it

Same story as its sibling - this pack installs once for both nodes. ComfyUI Manager → search comfyui-face-beauty, or:

cd ComfyUI/custom_nodes
git clone https://github.com/FeiJiu518/comfyui-face-beauty
# restart ComfyUI

It ships no models and only needs numpy/Pillow/torch, which ComfyUI already has. The genuine prerequisite is Impact Pack (plus, since v8.0, the Impact Subpack for UltralyticsDetectorProvider) so Face Crop Square has a segs to work from.

When to reach for it

If you just want better faces with minimal effort, FaceDetailer is still the one-stop and you don't need this at all. Reach for the Face Crop Square / Face Paste Back pair when you want your refinement in the middle - a restorer, a ControlNet pass, a particular upscaler. This is the half that puts it all back together without leaving a scar.

CategoryFaceBeauty

Inputs (4)

NameTypeDefaultDescription
original_imageIMAGE
processed_facesIMAGE
crop_dataFACE_CROP_DATA
featherINT160–128

Outputs (1)

NameTypeDescription
imageIMAGE