Nodes/ComfyUI-SuperNodes/🐧 Restore Mask Crop
ComfyUI Node

🐧 Restore Mask Crop

Paste the fixed face back exactly where it came from

By sonnyboxΒ·Created 11 months agoΒ·Updated 4 days agoΒ· 12
🐧 Restore Mask Crop
  • original_image
  • cropped_image
  • crop_info
  • cropped_mask
  • IMAGE
β—„scaleβ–Ύβ–Ί
β—„scale_methodβ–Ύβ–Ί

Cropping a face out to fix it is only half the job. The other half - the one that produces seam lines and scale mismatches when done by hand - is putting the result back where it came from, at the right size, blended so nobody can tell. That's this node's entire reason to exist. It's the paste-back half of the crop-regenerate-paste pattern, the mirror of the pack's Crop Image using Mask node, and it's where the "looks clean or looks edited" difference actually gets decided.

It comes from the 🐧 SuperNodes pack by SuperCC.

How it works

Three inputs do the heavy lifting: original_image (the untouched source), cropped_image (your processed crop), and crop_info - the CROP_INFO metadata straight out of Image Mask Crop, which carries the crop coordinates, original size, and a stored copy of the crop-space mask. Then:

  • strategy - the size-mismatch policy. scale_cropped resizes the incoming crop to fit the original hole. scale_original does the reverse: it scales the entire background image up so the new crop's scale becomes the image's scale. If you upscaled the crop 2Γ—, scale_original produces a 2Γ— larger composite - that's the mode for "I want the whole frame bigger because the face finally has real pixels."
  • scale_method - interpolation (nearest-exact, bilinear, area, bicubic, lanczos), matching ComfyUI's built-in image scale nodes.
  • cropped_mask (optional) - if connected, overrides the stored mask for blending. Mask values are the paste alpha: 1.0 = fully the new crop, 0 = fully the original. A soft-edged mask is a feather; without one, the stored mask patch from crop time is used, which is why Image Mask Crop bothers to save it.

The blend is done as src * alpha + dest * (1 - alpha) over the intersection region, with proper clipping so a crop that hangs off the edge doesn't crash - it just blends what overlaps.

When you'd reach for it

  • Face and hand detail passes: fix the crop, paste it back, keep every unmasked pixel bit-identical. This is the mask-inpainting advantage edit models can't match.
  • Any "crop tight, regenerate at native res, restore" workflow where the crop got upscaled in between - scale_original exists precisely for that.

Install

ComfyUI Manager, search "ComfyUI-SuperNodes", or:

cd ComfyUI/custom_nodes
git clone https://github.com/sonnybox/ComfyUI-SuperNodes

Restart ComfyUI. No models to download. The pack's only extra dependency is matplotlib (for Sigmas Graph). Heads-up: this pack targets ComfyUI's newer extension API, so update ComfyUI if the nodes don't appear.

Gotchas

  • Don't lose the crop_info wire. Without it the node has no idea where the hole is, and there's no sensible fallback.
  • scale_cropped on an upscaled crop squashes it back down to the hole size - the detail you paid for gets re-compressed. If you upscaled the crop, reach for scale_original or feed a downscaled copy.
  • The stored mask patch is a hard-edged rectangle unless you supplied a feathered one. For seamless results, either feather your mask or pass a soft cropped_mask. The node won't feather for you.

It's the least glamorous node in the pack and the one that decides whether your face-fix looks native or looks pasted. Do your blending homework here and the rest of the workflow stops mattering.

CategorySuperNodes/Image

Inputs (6)

NameTypeDefaultDescription
original_imageIMAGEThe original source image before cropping.
cropped_imageIMAGEThe processed cropped image to be pasted back.
crop_infoCROP_INFOThe crop metadata generated by the ImageMaskCrop node.
scaleCOMBOWhich image to resize on a size mismatch. 'cropped' resizes the incoming crop to fit the original hole. 'original' resizes the background to match the new crop scale.
scale_methodCOMBOThe interpolation method used for resizing images.
cropped_maskoptMASKAn optional mask to use for blending, overriding the original crop mask.

Outputs (1)

NameTypeDescription
IMAGEIMAGEThe composite image with the crop restored to its original location.