Nodes/ComfyUI-Replicate/Replicate batouresearch/magic-style-transfer
ComfyUI Node

Replicate batouresearch/magic-style-transfer

IP-Adapter style transfer on SDXL

By replicate·Created 2 years ago·Updated 2 years ago· 207
Replicate batouresearch/magic-style-transfer
  • image
  • ip_image
  • IMAGE
promptAn astronaut riding a rainbow unicorn
condition_depth_scale0.35
condition_canny_scale0.15
lora_scale0.90
ip_scale0.30
strength0.90
negative_prompt
background_color#A2A2A2
resizing_scale1.00
num_inference_steps30
num_outputs1
schedulerK_EULER
guidance_scale4.00
seed
apply_watermarktrue
lora_weights
force_rerunfalse

Magic Style Transfer takes the look of one image - its palette, texture, vibe - and applies it to a new generation. You give it a style reference and a prompt, and it renders your prompt in that style. Under the hood it's the classic SDXL + IP-Adapter recipe, with ControlNet depth/canny along for structural control. This node runs it on Replicate's cloud through ComfyUI-Replicate.

Style transfer is one of the friendlier consistency problems - it doesn't need precise geometric identity the way character consistency does, so IP-Adapter at a sensible strength does a genuinely good job of carrying an aesthetic across generations.

How it works

IP-Adapter injects image embeddings from your reference into the generation via decoupled cross-attention, so the model "sees" the style while it paints your prompt. The optional depth and canny ControlNet conditioning let you also borrow structure from an input image, not just style. The result is a new image that follows your text prompt but wears the reference's look. The node ships all of it to Replicate and returns an IMAGE.

Inputs and outputs that matter

Output is an IMAGE.

  • prompt - what to generate.
  • ip_image - the style reference image (the IP-Adapter input). This is the "make it look like this" slot.
  • ip_scale (0.3) - how strongly the style is applied. This is the main dial: too low and the style barely shows, too high and it overwhelms your prompt.
  • image - an optional structural input, used with the ControlNet scales.
  • condition_depth_scale (0.35) / condition_canny_scale (0.15) - how much depth and edge structure to borrow from image. Keep these modest unless you want the output to hug the input's layout.
  • strength (0.9) - overall img2img strength when working from an input image.

lora_scale, lora_weights (point it at a LoRA for extra style), num_inference_steps (30), scheduler, guidance_scale (4), num_outputs, and seed fill out the rest. force_rerun forces a fresh generation.

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

Image output, cleanly supported.

Almost every problem here is the ip_scale balance. If the style isn't coming through, raise it; if the output ignores your prompt and just apes the reference, lower it. Start around the default (0.3) and move in small steps - style strength is touchier than it looks. When you're also feeding a structural image, watch the two condition_*_scale values: crank them up and the output rigidly copies the input's composition, which is great when you want that and frustrating when you don't.

One thing to note: this is an SDXL-era, IP-Adapter-based approach. It works well for style, which is what it's for. If what you actually want is to keep a specific character consistent, that's a different (harder) job - reach for the consistent-character node or a trained LoRA instead. Also, apply_watermark defaults to on, so outputs carry an invisible SDXL watermark unless you turn it off. And the pack basics: a missing REPLICATE_API_TOKEN errors on the first run, and each call bills on Replicate.

CategoryReplicate

Inputs (19)

NameTypeDefaultDescription
promptoptSTRINGAn astronaut riding a rainbow unicorn
imageoptIMAGE
ip_imageoptIMAGE
condition_depth_scaleoptFLOAT0.350–2
condition_canny_scaleoptFLOAT0.150–2
lora_scaleoptFLOAT0.900–1
ip_scaleoptFLOAT0.300–1
strengthoptFLOAT0.900–1
negative_promptoptSTRING
background_coloroptSTRING#A2A2A2
resizing_scaleoptFLOAT1.001–10
num_inference_stepsoptINT301–500
num_outputsoptINT11–4
scheduleroptCOMBOK_EULER7 options: DDIM, DPMSolverMultistep, HeunDiscrete, KarrasDPM, K_EULER_ANCESTRAL, K_EULER, +1
guidance_scaleoptFLOAT4.001–50
seedoptINT
apply_watermarkoptBOOLEANtrue
lora_weightsoptSTRING
force_rerunoptBOOLEANfalse

Outputs (1)

NameTypeDescription
IMAGEIMAGE