Nodes/ComfyUI_RaykoStudio/๐ŸฆŠ RS Insert Crop
ComfyUI Node

๐ŸฆŠ RS Insert Crop

Paste a modified crop back into the original โ€” pixel-perfect, every time

By RaykosanยทCreated about a year agoยทUpdated 5 days agoยท 79
๐ŸฆŠ RS Insert Crop
  • original_image
  • cropped_image
  • IMAGE
โ—„crop_data{}โ–บ

The crop-and-stitch pattern is the community's standard way to fix a small region at high resolution: crop tight, run your model on just that region, paste it back. The hard part has always been the paste - if the coordinates are off by even a pixel, you get a visible seam. ๐ŸฆŠ RS Insert Crop (RSInsertCropImage) is the stitch half of that pattern. Feed it the original image, the edited fragment, and the CROP_DATA string that RSCropImage produced, and it puts the fragment back exactly where it came from.

How it works

Its inputs are original_image and cropped_image, plus an optional crop_data string (the serialized coordinates from the pack's crop node). It reads the position and size out of crop_data and composites the modified fragment onto the original at those exact coordinates. Because the crop and the insert are designed as a pair, the round-trip is bit-accurate: whatever RSCropImage carved out, this node puts back in the same place, at the same scale.

That's the whole job, and it's deliberately small. The power comes from what you run between them: crop a face region โ†’ inpaint or upscale just that region at full resolution โ†’ insert it back. Only the masked region changes; the rest of the frame never touches a sampler. That's exactly the property the inpainting community values most - unmasked pixels stay bit-identical, which no whole-frame edit model can offer.

Inputs and output

  • original_image - the untouched source.
  • cropped_image - the modified fragment (whatever your inpaint/upscale nodes produced).
  • crop_data (optional) - the CROP_DATA string from RSCropImage. If you leave it out, this node can't know where to paste, so in practice you always wire it.

Output: IMAGE - the composite, original with the edited region stitched back in.

How to install

Part of ComfyUI_RaykoStudio:

cd ComfyUI/custom_nodes
git clone https://github.com/Raykosan/ComfyUI_RaykoStudio.git

Restart ComfyUI, or install via ComfyUI Manager (search "ComfyUI_RaykoStudio"). No extra dependencies.

Common issues

  • Fragment pasted in the wrong spot. crop_data is the source of truth. If you changed the crop between runs, or fed a CROP_DATA from a different image size, the coordinates won't line up. Re-crop and regenerate the data.
  • Sticking out of bounds. If the fragment was resized to a different shape in the middle of the workflow, it may no longer fit - keep the aspect ratio between crop and insert.
  • I don't have a crop node. The optional crop_data means this can still paste something, but without coordinates there's no way to know where. Use it with RSCropImage; that's the intended pairing.

The honest take: on its own this node is meaningless - it's half of a pair, and the README presents it as such. As the second half of RSCropImage, though, it closes the loop on the most reliable way to edit one region of an image in ComfyUI without disturbing the rest. If you're doing face fixes, object swaps, or "only masked" inpainting, this is the stitch that makes the crop worth doing.

Category๐ŸฆŠ RaykoStudio

Inputs (3)

NameTypeDefaultDescription
original_imageIMAGEโ€”
cropped_imageIMAGEโ€”
crop_dataoptSTRING{}โ€”

Outputs (1)

NameTypeDescription
IMAGEIMAGEโ€”