Nodes/ComfyUI FRED Nodes v2/πŸ‘‘ FRED Image Uncrop From BBox
ComfyUI Node

πŸ‘‘ FRED Image Uncrop From BBox

Paste a processed crop back into its original image, seams hidden

By PoukpalaovaΒ·Created about a year agoΒ·Updated 7 months agoΒ· 3
πŸ‘‘ FRED Image Uncrop From BBox
  • original_image
  • cropped_image
  • bbox
  • optional_mask
  • image
  • help
β—„border_blending0.25β–Ί
β—„erode_size20β–Ί
β—„use_maskfalseβ–Ί
β—„resize_modebicubicβ–Ί
β—„bbox_modex0y0x1y1β–Ί

Crop a face, run a detail pass on it, paste it back - that loop is the backbone of every face-detailer workflow, and the "paste it back" half is where most people hand-roll a composite and get a visible rectangle. FRED_ImageUncropFromBBox does the paste properly: it places your cropped image back at the bounding box coordinates with a smooth gradient blend at the edges, and optionally follows a mask's shape instead of a hard rectangle. Think of it as the Detailer paste step without the detection machinery.

The inputs

  • original_image - the full, untouched frame.
  • cropped_image - what you're pasting back (possibly resized/regenerated).
  • bbox - the BBOX from the crop step, in x0y0x1y1 or xywh (bbox_mode). This is the same BBOX the FRED_CropFace node outputs, and it's compatible with Impact Pack-style BBOX wires.
  • border_blending (0–1, default 0.25) - how much edge feathering. 0 is a hard paste; 0.25 is a gentle fade; higher = wider gradient.
  • erode_size (default 20) - shrinks the mask inward before blurring, so the gradient only fades toward the interior of the pasted region instead of bleeding outside it. This is the detail that separates "seamless" from "blurry rectangle."
  • use_mask - when on, blending follows optional_mask's shape rather than the bbox rectangle. Great when the region you're pasting isn't rectangular (a face, a hand).
  • resize_mode - interpolation used when scaling the crop to match the bbox.

How the blending works

The cropped image is resized to the bbox dimensions (aspect preserved), then composited. With use_mask off it's a rectangular paste with a feathered border controlled by border_blending. With use_mask on it gets more clever: the mask is eroded inward by erode_size pixels, blurred to create a gradient, and only the inward-fading portion is used. The result is that the transition happens inside the pasted region, so there's no telltale outline - the mask naturally hugs the subject.

It handles batch math too: multiple images, bboxes, and masks are duplicated to match batch size, so a batch of cropped faces can be pasted back in one pass.

The workflow it completes

The natural FRED loop is: FRED_CropFace (crop + bbox) β†’ img2img or detail-sample the face β†’ FRED_ImageUncropFromBBox (paste back). And because the crop step feeds it a proper BBOX, you can also hand it crops from any Impact Pack detector output. That's the detect-crop-refine-paste loop from the detailer playbook, minus the bundled sampler - you control the resampling step yourself, which is more work but more control.

Outputs: image (the composited result) and help.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/Poukpalaova/ComfyUI-FRED-Nodes_v2.git

Restart, or "ComfyUI FRED Nodes v2" in ComfyUI Manager. Uses the pack's Pillow/numpy/opencv stack; if scipy is present it uses it for erosion, otherwise a fallback.

Gotchas

erode_size at 0 with use_mask on effectively disables the inward-gradient trick, so you'll get a more abrupt edge - keep it above ~10 for faces. And the pasted region blends in the same color space as the original, so if your detail pass noticeably shifted the crop's brightness/color, no blend can hide that; match your detail pass's exposure or do a color-balance step before pasting.

CategoryπŸ‘‘FRED/image/postprocessing

Inputs (9)

NameTypeDefaultDescription
original_imageIMAGEβ€”
cropped_imageIMAGEβ€”
bboxBBOXβ€”
border_blendingFLOAT0.250–1β€”
erode_sizeINT200–100β€”
use_maskBOOLEANfalseβ€”
resize_modeCOMBObicubic4 options: bilinear, bicubic, nearest, area
bbox_modeCOMBOx0y0x1y12 options: x0y0x1y1, xywh
optional_maskoptMASKβ€”

Outputs (2)

NameTypeDescription
imageIMAGEβ€”
helpSTRINGβ€”