Nodes/ComfyUI-off-suite/Paste Face Segment to Image
ComfyUI Node

Paste Face Segment to Image

Put the Fixed Face Back Where It Came From

By Off-Live·Created 3 years ago·Updated 2 years ago· 0
Paste Face Segment to Image
  • orig_image
  • crop_image
  • crop_data
  • IMAGE

The crop-and-refine loop only works if you can get the pixels back. This node is the return trip: take the original image, the fixed-up crop, and the CROP_DATA that records where the crop came from, and it pastes the crop back into place. It's the other half of the pair that starts with SEGS to Face Crop Data, and together they turn "detect a face, fix it, put it back" into three clean nodes.

It's part of ComfyUI-off-suite, Off-Live's face-utility pack. Nothing fancy, and that's the appeal - it's the exact paste-back step you'd otherwise rebuild with an ImageCompositeMasked and some coordinate math.

What you plug in

  • orig_image - the untouched original frame.
  • crop_image - the edited crop (from a detailer, an inpaint sampler, img2img, whatever you ran in between).
  • crop_data - the CROP_DATA record from the crop side (SEGS to Face Crop Data outputs exactly this). It holds the top-left (x, y) of the crop region in the original image.

The node does a direct pixel paste: it assigns crop_image into orig_image at the recorded coordinates. One IMAGE comes out - the composited frame.

The two things that will bite you

1. It's an in-place paste. The code writes into the orig_image tensor and returns the same tensor object. That's fine for the standard linear graph, but if you're also routing the original image somewhere else in the graph that expects it unmodified, you can get cross-contamination. If that matters, branch through a copy node or a separate load.

2. Garbage in, garbage at the recorded spot. The paste uses the coordinates verbatim. If the crop you're pasting doesn't match the region the CROP_DATA describes - you resized it, you cropped it again, you changed the aspect ratio - the result is a misaligned or overflowing paste, and the node won't warn you. The classic failure: your inpaint pass changed the crop's dimensions, so the "fixed" face lands off-center on the original. Keep the crop's geometry identical to what came out of the detector, and this node is boring and correct. Change the geometry, and it's on you.

Where it fits

The full loop in off-suite's own vocabulary: SEGS to Face Crop Data (get face + its CROP_DATA) → upscale or inpaint or detail the crop → Paste Face Segment to Image (put it back). It's the same detect-crop-resample-paste machinery that makes Impact Pack's FaceDetailer work, exposed as individual steps so you can insert whatever you want in the middle - a high-res pass, a face-restore model, a hand-fix inpaint.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/Off-Live/ComfyUI-off-suite
# or: ComfyUI Manager → search "ComfyUI-off-suite"

No extra dependencies. Needs Impact Pack for the CROP_DATA type and a SEGS-producing detector upstream. Same pack-wide caveat: the repo's been quiet since mid-2024, so treat it as stable-but-frozen - for a paste node, that's plenty.

CategoryOFF

Inputs (3)

NameTypeDefaultDescription
orig_imageIMAGE
crop_imageIMAGE
crop_dataCROP_DATA

Outputs (1)

NameTypeDescription
IMAGEIMAGE