Nodes/ComfyUI-RefineNode/RefineNode Paste Back
ComfyUI Node

RefineNode Paste Back

The paste-back node that puts your refinement back where it belongs

By 1Kynx·Created 4 months ago·Updated 25 days ago· 30
RefineNode Paste Back
  • generated_image
  • info
  • image
  • paste_mask
paste_back_modemask
mask_grow3
blend_blur5

Local refinement only earns its keep if the edited region gets composited back into the original image without leaving a seam. RefineNode Paste Back is the node that does that in ComfyUI-RefineNode. It takes the image the model generated, the info metadata that tracked where that region came from, and drops the result back onto the original - so the other 99% of the frame stays bit-identical. That bit-identical guarantee is precisely what whole-frame editors like Qwen-Image-Edit and Flux Kontext can't give you, and it's the entire reason the masked-refinement genre still exists.

What it needs

Three inputs, and two of them are sacred:

  • generated_image - whatever the model produced for the region(s).
  • info - the REFINENODE_INFO from RefineNode Preprocess Mask, possibly updated by RefineNode Reference Image Process. This is what tells Paste Back the original image, the crop box, and the mask coordinates. Disconnect it and the node has nowhere to put anything.
  • paste_back_mode - mask pastes using the original mask shape (default); bbox pastes using the mask's bounding box.

The other two dials fix seams:

  • mask_grow (default 3) - expands the paste mask before compositing. The model rarely renders right up to the mask edge, so a few pixels of growth stops a hairline of the old region peeking through.
  • blend_blur (default 5) - blurs/feathers the paste mask to soften the transition. Zero gives hard edges, which you want for hard-edged logos and text; a higher value blends a portrait region into its surroundings.

Outputs are image (the composited result) and paste_mask (the actual mask used, so you can preview and debug exactly what got pasted).

How the magic stays invisible

Here's the mechanism, worth understanding because it explains a lot of weird ComfyUI behavior. Both generated_image and info arrive as lists. The node groups the info items by which original source image they came from (the group_id), then pastes every generated result that belongs to the same source image back onto that original, one after another. You get one final image and one combined paste mask per source image. So a batch of five mask regions becomes one finished product shot, with all five fixes in place - not five loose tiles you have to assemble yourself.

Under the hood each generated patch is first mapped back into model-space (reversing whatever Reference Image Process did), then composited onto the original crop via the grown-and-blurred mask, then the crop is pasted back at the recorded crop_box. Get the info chain right and all of that is automatic.

Installing and running it

Standard pack install - ComfyUI Manager, search "ComfyUI-RefineNode", or:

cd ComfyUI/custom_nodes
git clone https://github.com/1Kynx/ComfyUI-RefineNode.git

Restart ComfyUI. No dependencies beyond what ComfyUI already has. This node doesn't need the Qwen model stack on its own - it's pure compositing - but the included example workflows pair it with the RefineAnything LoRA on Qwen-Image-Edit 2511, which you'll need to grab separately for a full pipeline.

Troubleshooting

  • "requires one generated image per RefineNode info item" - you've got more info items than generated images, which happens when a mask batch produces jobs the model never got run on. Match the counts.
  • Thin ring of old content around the edit - raise mask_grow. That's its whole job.
  • Harsh transition on soft subjects - raise blend_blur.
  • Results pasted at the wrong spot entirely - the info chain broke between Preprocess Mask and here. Re-wire it.
CategoryRefineNode

Inputs (5)

NameTypeDefaultDescription
generated_imageIMAGE
infoREFINENODE_INFO
paste_back_modeCOMBOmask2 options: mask, bbox
mask_growINT30–256
blend_blurINT50–256

Outputs (2)

NameTypeDescription
imageIMAGE
paste_maskMASK