ComfyUI Node Runs on cloud

SEGSPaste

Composite your refined regions back onto the original

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,242
SEGSPaste
  • image
  • segs
  • ref_image_opt
  • IMAGE
feather5
alpha255

SEGSPaste is the last step of the manual detailing loop, and it's the one that keeps your background pristine. The Impact Pack way of fixing faces is: detect regions, refine each cropped region on its own with SEGSDetailer, then stitch the improved crops back into the full picture. SEGSPaste does that last stitch. Its own description says it plainly: it "pastes the enhanced SEGS, improved through the SEGS detailer, back onto the original image."

Why bother when FaceDetailer does the whole loop in one node? Control. Splitting detect / refine / paste lets you inspect and filter between stages - preview the refined crops, drop the bad detections, only then composite. If you're building anything past a one-click face fix, you end a SEGS chain here.

How it works

The refined crops live inside the SEGS after SEGSDetailer. SEGSPaste takes your original image, drops each refined crop back into its detected location, and blends the seam so the fix doesn't look pasted-on. This is the same principle the inpainting world settled on years ago: composite only the changed pixels back onto the original so the rest of the frame never round-trips the VAE and degrades. Here the pack handles that compositing for you.

The blend is controlled by feather, which softens the edge of each pasted region so there's no hard line between old and new pixels - the SEGS equivalent of mask blur in classic inpainting.

The inputs that matter

  • image - the original, full-size image you're pasting onto. Required.
  • segs - the refined SEGS from SEGSDetailer, carrying the improved crops. Required.
  • feather (default 5) - edge softening in pixels. Bump it to 10–20 if you can see a seam around the fixed region; keep it low when the detailer output already matches tightly.
  • alpha (default 255) - opacity of the paste, 0–255. At 255 the refined region fully replaces the original; lower it to blend the fix partway back toward the source for a subtler effect.

There's one optional input, ref_image_opt. Per the README, if you supply it, "the images contained within SEGS are ignored" and the crop is taken from this reference image instead - handy for AnimateDiff and other cases where you want to paste from a different source than the one baked into the SEGS. It must match the original image size. Output is a single composited IMAGE.

How to install it

ComfyUI Manager: search ComfyUI Impact Pack, install, restart. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack, install requirements into ComfyUI's Python (pip install -r requirements.txt, or ..\..\..\python_embeded\python.exe -m pip install -r requirements.txt for Windows portable), restart. No auto-install since v7.6. A small SAM model downloads to ComfyUI/models/sams on first run.

Common issues

Visible seams around the fix. Raise feather. If the outline of the region is still obvious, the real cause is usually a bounding-box mask giving you a rectangular paste - feed the detection through a SAM or segmentation pass earlier so the mask follows the actual silhouette, then feather.

The paste lands in the wrong spot or errors. Size mismatch. The image (and ref_image_opt, if used) must be the same dimensions the SEGS were detected on. Detect and paste on the same resolution.

Nothing changed. If the SEGS never went through SEGSDetailer, there are no refined crops to paste and you'll get back your original untouched. Confirm a detailer sits between the detector and this node - SEGSPaste composites results, it doesn't generate them.

CategoryImpactPack/Detailer

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
segsSEGS
featherINT50–100
alphaINT2550–255
ref_image_optoptIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE