Nodes/ComfyUI-Replicate/Replicate batouresearch/magic-image-refiner
ComfyUI Node

Replicate batouresearch/magic-image-refiner

Refine and enhance an image

By replicate·Created 2 years ago·Updated 2 years ago· 206
Replicate batouresearch/magic-image-refiner
  • image
  • mask
  • IMAGE
prompt
resolutionoriginal
resemblance0.75
creativity0.25
hdr0.00
schedulerDDIM
steps20
guidance_scale7.00
seed
negative_promptteeth, tooth, open mouth, longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, mutant
guess_modefalse
force_rerunfalse

Magic Image Refiner is an img2img enhancement pass: feed it an image (optionally with a mask) and it re-renders it with more detail and coherence, at a strength you control. It sits in the space between "upscale" and "inpaint" - you can use it to polish a whole image, or mask a region and have it refine just that part. This node runs it on Replicate's cloud via ComfyUI-Replicate.

The reason it's nice as a single node is the two-dial design: one slider for how much of the original to keep, one for how much freedom to invent. That maps cleanly onto the real question in any refine pass - "make it better without making it a different picture."

How it works

It's a ControlNet-guided img2img refiner. The input image conditions the generation so the composition survives, while a diffusion pass adds detail and cleans up artifacts. The resemblance and creativity dials trade those two forces against each other. With a mask, it confines the work to the masked region like an inpaint. The node sends everything to Replicate and returns an IMAGE.

Inputs and outputs that matter

Output is an IMAGE.

  • image - the source to refine.
  • resemblance (0.75) - how closely to stick to the original. High keeps it faithful.
  • creativity (0.25) - how much the model is allowed to change. These two are the pair you'll actually tune; nudge creativity up for more enhancement, down to stay safe.
  • mask - optional; supply one to refine only a region (inpaint-style).
  • resolution - original, 1024, or 2048. Bumping this gives you an upscale-and-refine in one.
  • prompt / negative_prompt - guide the refinement; the negative is pre-filled to suppress common artifacts.
  • hdr (0) - adds HDR-style punch; small values go a long way.

scheduler, steps (20), guidance_scale (7), and seed are the usual diffusion controls. force_rerun forces a fresh pass.

How to install it

ComfyUI Manager: search ComfyUI-Replicate, install, restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/replicate/comfyui-replicate
cd comfyui-replicate
pip install -r requirements.txt

Restart, and set your token first:

export REPLICATE_API_TOKEN="r8_************"; python main.py

Token: replicate.com/account/api-tokens.

Common issues

Clean image output, fully supported.

The tuning trap is the resemblance/creativity balance. Push creativity too high and the refiner stops refining and starts replacing - you get a nice image that's no longer your image, faces and details drifting. Too low and nothing visibly improves. Start near the defaults (0.75 / 0.25) and move in small steps. If you only want to fix one area, use the mask rather than turning creativity up globally.

As with any generative enhancement, treat recognizable faces carefully - a strong refine pass can shift identity. Do faces at low creativity, or mask around them. And the pack basics: a missing REPLICATE_API_TOKEN errors on the first run, higher resolution costs more per run, and every call bills on Replicate.

CategoryReplicate

Inputs (14)

NameTypeDefaultDescription
promptoptSTRING
imageoptIMAGE
maskoptIMAGE
resolutionoptCOMBOoriginal3 options: original, 1024, 2048
resemblanceoptFLOAT0.750–1
creativityoptFLOAT0.250–1
hdroptFLOAT0.000–1
scheduleroptCOMBODDIM4 options: DDIM, DPMSolverMultistep, K_EULER_ANCESTRAL, K_EULER
stepsoptINT20
guidance_scaleoptFLOAT7.000.1–30
seedoptINT
negative_promptoptSTRINGteeth, tooth, open mouth, longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, mutant
guess_modeoptBOOLEANfalse
force_rerunoptBOOLEANfalse

Outputs (1)

NameTypeDescription
IMAGEIMAGE