Upscaling with a model
Lesson "upscale", in the group Pictures: techniques of the lesson list. Steps: 7.
What you will be able to do
The finished picture is enlarged by a model that draws sharp detail instead of stretching the pixels.
What you need
- It goes on from A first picture from text. The card says so; it is a hint, not a lock.
- Nodes: Load Checkpoint, CLIP Text Encode (Prompt), KSampler, VAE Decode, Save Image / Preview Image, Load Upscale Model, Upscale Image (using Model), Save 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 an upscale model is (reading)
An upscale model is a small network trained to enlarge pictures: it draws edges and textures where simple stretching gives blur. It does not know your prompt and adds nothing new: it makes what is there larger.
The lesson adds three nodes to the graph of "A first picture from text".
A picture graph is needed
This lesson goes on from the graph of "A first picture from text". The canvas must have Load Checkpoint, the two texts CLIP Text Encode (Prompt) and CLIP Text Encode (Prompt), KSampler, VAE Decode and Save Image with the links between them.
If they are not there, do that lesson first.
Load the upscale model
Add a Load Upscale Model node and choose the model in its
model_namefield. ComfyUI looks for these files inmodels/upscale_models.The number in the name says how many times it enlarges: 4x is four times, 2x is twice. Some models are trained for photos, others for drawings.
Files in old formats (.pth, .pt) can run code when they are loaded: take them only from the model's official page or a collection you trust, such as OpenModelDB.
Enlarge the picture
Add a Upscale Image (using Model) node. The output of Load Upscale Model goes into its
upscale_modelinput, theIMAGEoutput of VAE Decode intoimage.Save the large picture
Add one more Save Image node and connect the output of Upscale Image (using Model) to its
imagesinput.The graph now saves the picture twice, as drawn and enlarged. Compare them at full size.
What an upscale model can and cannot do (reading)
- A 4x model turns a 1024 picture into 4096 pixels a side, sixteen times the pixels: that takes memory and time. Take a 2x model, or make the result smaller afterwards.
- It does not fix a wrong hand or a blurred face: it enlarges the mistake. A second pass does that, the next lesson.
- Different models suit different pictures: compare two on the same picture.
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.
Next, "A second pass after upscaling (hires fix)" adds detail to the large picture.
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, A picture graph is needed:
- a Load Checkpoint node.
- a CLIP Text Encode (Prompt) node.
- a CLIP Text Encode (Prompt) node.
- a KSampler node.
- a VAE Decode node.
- a Save Image or Preview Image node.
CLIPof Load Checkpoint intoclipof CLIP Text Encode (Prompt) (prompt) (a Load LoRA or CLIP Set Last Layer in between is accepted).CLIPof Load Checkpoint intoclipof CLIP Text Encode (Prompt) (negative prompt) (a Load LoRA or CLIP Set Last Layer in between is accepted).MODELof Load Checkpoint 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 CLIP Text Encode (Prompt) (prompt) 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 CLIP Text Encode (Prompt) (negative prompt) intonegativeof 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).LATENTof KSampler intosamplesof VAE Decode.VAEof Load Checkpoint intovaeof VAE Decode.IMAGEof VAE Decode intoimagesof Save Image or Preview Image (first picture).
- Step 3, Load the upscale model:
- a Load Upscale Model node.
model_nameof Load Upscale Model: a value is chosen.
- Step 4, Enlarge the picture:
- a Upscale Image (using Model) node.
UPSCALE_MODELof Load Upscale Model intoupscale_modelof Upscale Image (using Model).IMAGEof VAE Decode intoimageof Upscale Image (using Model).
- Step 5, Save the large picture:
- a Save Image node.
IMAGEof Upscale Image (using Model) intoimagesof Save Image (large picture).
What next
These lessons go on from this one: A second pass after upscaling (hires fix).