RefineAnything_Pasteback
Stitch it back without the sticker look
- generated_image
- cond
- image
- transparent_bg
So you cropped to the mask, ran the sampler, and now you have a beautifully refined region floating in space. Slap it back onto the original and you get the classic failure: a hard seam and a region that's technically fixed but looks pasted on, because the edit model's lighting never quite matched the surrounding photo. RefineAnything_Pasteback is the other half of the pack, and its whole job is to make that patch disappear.
How it works
It's crop-and-stitch with the polish bolted on. The node takes your generated crop and the cond context from RefineAnything_PreImg, then:
- Grows the mask (
mask_grow, default 3) with a max filter so the blend area extends a few pixels past the boundary instead of cutting on a hairline. - Blurs it (
blend_blur, default 5) so the alpha falloff is gradual - the modern equivalent of feathering an inpaint mask. - Blends through that mask, with color alignment on top so the patch picks up the original's local tone rather than carrying its own.
That last bit is the difference between "fixed" and "seamless". By default adain is on, which runs an adaptive-instance-normalization color fix (borrowed from the well-known sd-webui colorfix trick) to transfer the surrounding image's color and lighting statistics onto the crop before compositing. Leave it on; it's the reason the result doesn't scream "I was inpainted."
The inputs that matter
generated_image- the decoded output of your sampler, i.e. the edited crop. Wire KSampler → VAE Decode → here.cond- the conditioning output fromRefineAnything_PreImg, same run. It carries the original image, the cropped mask, and the crop coordinates. This is why you mustn't rebuild the graph between runs: acondfrom a different image or a different crop will paste in the wrong place.adain(default on) - the color-alignment switch. Keep it on for photos.wavelet(default off) - a heavier wavelet-based color reconstruction, if AdaIN flattens the tone and you need finer low-frequency matching. Slower, and it switches the compositing code path, so test it before relying on it.mask_grow/blend_blur- seam control. Crankblend_blurif you see a boundary; dial it down if the fix bleeds into untouched areas.save_rgba(default on) - writes the composited region out as a transparent PNG into your ComfyUI output folder.
Outputs
image is the full original with the refined region composited in - that's your final result. transparent_bg is the edited crop alone on a transparent background, which is genuinely useful if you're doing sprite or product work and want to drop the fixed region onto a different background. Note that transparent RGBA doesn't preview meaningfully in a plain Preview Image node, so don't panic if it looks black there.
Installing
No extra dependencies - it ships in the pack's single __init__.py. ComfyUI Manager: search ComfyUI_RefineAnything, or:
cd ComfyUI/custom_nodes
git clone https://github.com/smthemex/ComfyUI_RefineAnything
Restart and the node appears. The model side is the real work: the RefineAnything LoRA from limuloo1999/RefineAnything on Hugging Face plus a Qwen-Image-Edit-2511 stack (diffusion model, CLIP, VAE). A 20B model, so on most consumer GPUs you'll want a GGUF quant.
Troubleshooting
- Seam still visible with
adainon. Raiseblend_blurfirst, then trywaveleton. If it still shifts, the culprit may not be here at all - community reports on the example workflow's Edit Model Reference Method node sayindex_timestep_zeroproduces a noticeable color shift, and switching toindexor another method fixes it upstream. - The patch lands in the wrong place. Your
condandgenerated_imagedon't match - they must come from the same PreImg/sampler run. transparent_bglooks broken. It's RGBA; preview it via a node that handles alpha or just look at the saved PNG.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| generated_image | IMAGE | — | |
| cond | CONDITIONING | — | |
| mask_grow | INT | 30–4097 | — |
| blend_blur | INT | 50–4096 | — |
| adain | BOOLEAN | true | — |
| wavelet | BOOLEAN | false | — |
| save_rgba | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| transparent_bg | IMAGE | — |