A reference picture for style (Flux Redux)
Lesson "style-reference", in the group Pictures: techniques of the lesson list. Steps: 9.
What you will be able to do
A Flux.1 picture takes its look from a sample picture: colours, materials, mood.
What you need
- It goes on from Flux.1: a picture from separate files. The card says so; it is a hint, not a lock.
- Nodes: Load Diffusion Model, DualCLIPLoader, Load VAE, CLIP Text Encode (Prompt), ConditioningZeroOut, Load Image, Load CLIP Vision, CLIP Vision Encode, Load Style Model, Apply Style Model, EmptySD3LatentImage, KSampler, VAE Decode, Save Image / Preview Image.
- The app downloads and installs nothing. The step texts below say which files and folders, and which ComfyUI template names them.
The steps
The words of each step, as the lesson shows them. Node names are in bold.
What Redux does (reading)
Words describe a style poorly. Redux lets you show it: a vision model looks at a sample picture, and a small style model turns what it saw into an addition to the prompt.
The graph is ComfyUI's Flux.1 dev graph with the part of the official "Flux Redux" template that does this. It is built from an empty canvas: "File ▸ New project". Flux.1 dev needs a strong graphics card; its fp8 files need less memory.
Load Flux.1
Add Load Diffusion Model, DualCLIPLoader and Load VAE.
unet_nameof Load Diffusion Model: flux1-dev, frommodels/diffusion_models.- DualCLIPLoader reads the prompt with two files:
clip_name1clip_l,clip_name2t5xxl. Settypetoflux. vae_nameof Load VAE: ae.
If the file you need is not in the list, your ComfyUI does not have it. The app downloads nothing. The easiest way is to open, in ComfyUI itself, the official template "Flux Redux": it shows which files are missing and where to put them. Then choose "Sync ▸ Sync now" in this app's menu, and the files appear in the lists.
Write the prompt
Add CLIP Text Encode (Prompt) and ConditioningZeroOut. The output of DualCLIPLoader goes into
clipof CLIP Text Encode (Prompt), the output of CLIP Text Encode (Prompt) intoconditioningof ConditioningZeroOut. Write intextwhat the picture shows: the subject, the place.Flux does not use a prompt of what is unwanted. ConditioningZeroOut gives the sampler an empty one, as ComfyUI's Flux template does.
Show the sample
Add Load Image, Load CLIP Vision and CLIP Vision Encode.
- In Load Image choose the sample picture.
- In
clip_nameof Load CLIP Vision: sigclip_vision_patch14_384, frommodels/clip_vision. - CLIP Vision Encode gets
clip_visionfrom Load CLIP Vision andimagefrom Load Image.
The vision model turns the picture into numbers that say what is in it and how it looks.
Apply the style model
Add Load Style Model and Apply Style Model.
- In
style_model_nameof Load Style Model: flux1-redux-dev, frommodels/style_models. - Apply Style Model gets
conditioningfrom CLIP Text Encode (Prompt),style_modelfrom Load Style Model,clip_vision_outputfrom CLIP Vision Encode.
The output of Apply Style Model is your prompt with the sample added to it.
- In
The empty latent and the sampler
Add EmptySD3LatentImage and KSampler. Connect:
modelfrom Load Diffusion Model,positivefrom Apply Style Model,negativefrom ConditioningZeroOut,latent_imagefrom EmptySD3LatentImage. Setcfgto 1.Flux.1 dev is distilled: it follows the prompt without the usual guidance, and a higher
cfgburns the picture. An empty latent of 1024 × 1024 suits it.Decode and save
Add VAE Decode and Save Image: the output of KSampler into
samples, the output of Load VAE intovae, the picture intoimages.When the sample wins over the words (reading)
At
strength1 of Apply Style Model Redux often copies the sample and forgets the prompt. Lower it to 0.5 and the words get their say again.Two samples: chain two Apply Style Model nodes, the output of the first into
conditioningof the second, each with its own picture, as the template does.For SD 1.5 and SDXL the same idea is IP-Adapter, see "A reference picture with IP-Adapter".
The graph is ready (reading)
Save the graph with "File ▸ Save workflow for ComfyUI…", open the file in ComfyUI and run it there. This app runs nothing in ComfyUI itself.
What to try: one prompt with two very different samples.
What the lesson checks
A reading step is done when you press Got it, next. A doing step ticks itself off when the canvas holds:
- Step 2, Load Flux.1:
- a Load Diffusion Model node.
- a DualCLIPLoader node.
- a Load VAE node.
unet_nameof Load Diffusion Model: a value is chosen.clip_name1of DualCLIPLoader: a value is chosen.clip_name2of DualCLIPLoader is not the same file asclip_name1of DualCLIPLoader.typeof DualCLIPLoader isflux.vae_nameof Load VAE: a value is chosen.
- Step 3, Write the prompt:
- a CLIP Text Encode (Prompt) node.
- a ConditioningZeroOut node.
CLIPof DualCLIPLoader intoclipof CLIP Text Encode (Prompt).CONDITIONINGof CLIP Text Encode (Prompt) intoconditioningof ConditioningZeroOut.textof CLIP Text Encode (Prompt) holds at least 3 characters.
- Step 4, Show the sample:
- a Load Image node.
- a Load CLIP Vision node.
- a CLIP Vision Encode node.
CLIP_VISIONof Load CLIP Vision intoclip_visionof CLIP Vision Encode.IMAGEof Load Image intoimageof CLIP Vision Encode (a Upscale Image or Upscale Image By or Scale Image to Total Pixels or FluxKontextImageScale or Resize Image or ImageResizeKJv2 or Pad Image for Outpainting in between is accepted).imageof Load Image: a value is chosen.clip_nameof Load CLIP Vision: a value is chosen.
- Step 5, Apply the style model:
- a Load Style Model node.
- a Apply Style Model node.
CONDITIONINGof CLIP Text Encode (Prompt) intoconditioningof Apply Style Model (a FluxGuidance or Apply Style Model in between is accepted).STYLE_MODELof Load Style Model intostyle_modelof Apply Style Model.CLIP_VISION_OUTPUTof CLIP Vision Encode intoclip_vision_outputof Apply Style Model.style_model_nameof Load Style Model: a value is chosen.
- Step 6, The empty latent and the sampler:
- a EmptySD3LatentImage node.
- a KSampler node.
MODELof Load Diffusion Model intomodelof KSampler (a Load LoRA or LoraLoaderModelOnly or DifferentialDiffusion or ModelSamplingAuraFlow or ModelSamplingFlux or CFGNorm or IPAdapter Unified Loader or IPAdapter or IPAdapterAdvanced or IPAdapterStyleComposition in between is accepted).CONDITIONINGof Apply Style Model intopositiveof KSampler (a Apply ControlNet or InpaintModelConditioning or Conditioning (Combine) or ConditioningSetArea or ConditioningSetAreaPercentage or ConditioningSetMask or Apply Style Model or FluxGuidance or ConditioningZeroOut or FluxKontextMultiReferenceLatentMethod in between is accepted).CONDITIONINGof ConditioningZeroOut intonegativeof KSampler.LATENTof EmptySD3LatentImage intolatent_imageof KSampler.cfgof KSampler is1.
- Step 7, Decode and save:
- a VAE Decode node.
- a Save Image or Preview Image node.
LATENTof KSampler intosamplesof VAE Decode.VAEof Load VAE intovaeof VAE Decode.IMAGEof VAE Decode intoimagesof Save Image or Preview Image.