FC CropToOrigin
Putting the face back where it came from — FCCropToOrigin explained
- origin_image
- origin_box
- origin_mask
- paste_image
- IMAGE
FC CropToOrigin is the node that closes the loop in the FaceChain inpainting workflow. FC FaceDetectCrop cuts a face out, the sampler generates a new face into that crop, and this node pastes the result back onto the original image in exactly the right spot. Crop, inpaint, paste back - it's the classic masked-inpainting pattern, and without this step you'd be hand-aligning crops like it's 2022.
The catch is in the README's own words: it "can only be used in conjunction with FC FaceDetectCrop in square 512 width height mode." That's not a suggestion. The node's math assumes the pasted image was produced by that specific crop mode, because that mode reserves a square region of fixed geometry around the face. Wire it up with a normal-mode crop and the alignment silently drifts.
Inputs and outputs
Four required inputs, one IMAGE output:
- origin_image - the original full photo you cropped from
- origin_box - the face bounding box (
BOX) that came out ofFC FaceDetectCrop - origin_mask - the mask cropped from the original image (also from
FC FaceDetectCrop) - paste_image - the newly generated face crop to composite in; must match the origin mask's size
Under the hood it reconstructs the square crop region around the box center, resizes your paste_image back to the region it was cut from, erodes the mask a touch (so the seam lands slightly inside the face area), blanks out the original face region, and composites. The output IMAGE is the full original image with the new face in place, ready for a preview node or the next step in your graph.
How to use it
The graph reads: Load Image → FC FaceDetectCrop (square 512 width height mode) → the crop feeds KSampler → FC CropToOrigin takes the original image, the box, the mask, and the sampler's output, and returns the stitched result. Everything downstream of the crop just has to survive until this node without being resized, or the geometry breaks.
Practical notes
- The node is in the
facechain/maskcategory and lives in the pack's default crop/inpaint workflow. If you're building from the README'sworkflow_inpaiting_inference.png, this is the node at the end of the chain. - First use of the crop upstream triggers the ModelScope model downloads (face detection, segmentation), so a fresh install's first run is slow.
- Don't resize
paste_imagebetween the sampler and this node. The whole trick depends on sizes lining up.
Install the pack via ComfyUI Manager (search "ComfyUI-FaceChain") or git clone https://github.com/THtianhao/ComfyUI-FaceChain into custom_nodes/, then restart. The pack auto-installs its heavyweight deps (onnxruntime-gpu, mmdet, mmcv, modelscope, insightface…) on startup, so the first launch after install takes a while. Once that's done, this node itself is pure image math - no per-run downloads of its own.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| origin_image | IMAGE | — | |
| origin_box | BOX | — | |
| origin_mask | MASK | — | |
| paste_image | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |