Nodes/comfyui-timesaver/TS Restore From Crop
ComfyUI Node

TS Restore From Crop

Paste the sharpened face back without a visible seam

By AlexYez·Created 2 years ago·Updated about 23 hours ago· 12
TS Restore From Crop
  • original_images
  • cropped_images
  • crop_data
  • IMAGE
blur64
blur_typeGaussian
force_gputrue

The classic ComfyUI memory trick: you've got a 4K image, and the only part that needs real work is the face in the corner. Running an upscaler or face restorer on the whole frame burns VRAM and time for nothing. The standard fix is crop → process the small region → paste back - and this node is the paste-back half. Feed it the original frame, the processed crop, and the crop geometry, and it composites the result with feathered seams.

How it works

TSRestoreFromCrop is the second half of a pair. First TS Crop To Mask cuts a region out around a mask (with optional padding and a max-resolution clamp) and hands you both the crop and a crop_data blob. Then this node takes that blob, the processed crop, and the original frames, and pastes the crop back exactly where it came from - scaling and positioning it from the geometry, not by eyeballing coordinates.

The two controls are both about the seam. blur (default 64, 0–256) is the feather width in pixels used to blend the pasted edges into the original - 0 is a hard edge, which you almost never want. blur_type picks the kernel: Gaussian is smoother (the default, and the right choice for anything with gradients like skin or sky), Box is faster and harder (fine for texture regions where a soft blend would look muddy). force_gpu runs the paste on the GPU when CUDA is available, falling back to CPU otherwise.

Output is a single IMAGE: the original frame with the processed crop blended in.

Wiring it up

The inputs are original_images (full-size source frames), cropped_images (the processed crop, from TS Crop To Mask), crop_data (the geometry blob), then the blur settings. The classic flow:

  1. TS Crop To Mask → small crop around the face/object
  2. upscaler or face restorer on the crop (tiny VRAM footprint)
  3. TSRestoreFromCrop → original + processed crop + crop_data → final composite

That's the exact "process only the interesting region" pattern from the README, and it's the same loop the masking-detection-detailing docs describe: crop, upscale, re-render, paste back - the only thing this node adds to the classic recipe is that the paste is feathered instead of a hard rectangle.

Install

No extra dependencies - part of comfyui-timesaver.

cd ComfyUI/custom_nodes
git clone https://github.com/AlexYez/comfyui-timesaver
cd comfyui-timesaver
python -m pip install -r requirements.txt

Restart ComfyUI and search "TS Restore From Crop".

Common issues

  • "The crop pasted in the wrong place." The geometry comes from crop_data, so if that's wrong the paste is wrong - make sure the original_images you feed here are the same frames that went into TS Crop To Mask. Feed a differently-sized frame and the coordinates are meaningless.
  • "I can see the rectangle." Crank blur up (64 is the default, but seams on real photos often want more) or switch blur_type to Gaussian. A visible edge at blur 0 is expected, not a bug.
  • "It works but feels slow." It's mostly the feathering on a large frame; force_gpu helps when CUDA is around.

The honest expectation: this won't invent detail - it just puts detail back. The sharpening happens in whatever you run between the crop and the restore. And if you only need a clean upscale with no mask involved, the README's own advice is to reach for the tile splitter/merger pair instead.

CategoryTS/Image/Tiles

Inputs (6)

NameTypeDefaultDescription
original_imagesIMAGEFull-size source frames to paste the processed crop back into.
cropped_imagesIMAGEProcessed crop to paste back, from TS Crop To Mask.
crop_dataCROP_DATACrop geometry from TS Crop To Mask that tells the node where to paste.
blurINT640–256Feather width in pixels for blending the pasted crop edges into the original. 0 = hard edge.
blur_typeCOMBOGaussianEdge-blend kernel: Gaussian is smoother, Box is faster and harder.
force_gpuBOOLEANtrueRun the paste on GPU when CUDA is available; otherwise falls back to CPU.

Outputs (1)

NameTypeDescription
IMAGEIMAGE