A first picture from text
Lesson "image", in the group Pictures: first steps of the lesson list. Steps: 11.
What you will be able to do
You build a graph of seven nodes that draws a picture from a prompt.
What you need
- Model files the lesson checks:
- a picture model (SD 1.5, SDXL, Pony, Illustrious, Flux and the like), not a video model:
models/checkpoints, for examplejuggernautXL_v9.safetensors.
- a picture model (SD 1.5, SDXL, Pony, Illustrious, Flux and the like), not a video model:
- Nodes: Load Checkpoint, CLIP Text Encode (Prompt), Empty Latent Image, 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.
How a graph works (reading)
A graph reads from left to right. Each node does one thing, and the lines between nodes, the links, carry the result on.
This lesson has seven nodes: the model loader, two texts, a blank, the sampler, the turn into a picture and the saving.
A node is added by a double click in the library on the left or with the "Node" button on the canvas toolbar. You build. The app watches the canvas and ticks a step off when it is done.
If the canvas already holds another graph, start from an empty one: "File ▸ New project".
Load the model
Add a Load Checkpoint node. Choose the model file in its
ckpt_namefield.This is the model that draws. One file holds three parts, so the node has three outputs:
MODELdraws,CLIPunderstands text,VAEturns the result into a picture.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, a ready template for a picture from text: 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.
Add two texts
Add two CLIP Text Encode (Prompt) nodes. One will hold what you want to see. The other holds what must not be in the picture.
There are two nodes because the sampler takes these texts through different inputs.
Connect the texts to the model
Drag a link from the
CLIPoutput of Load Checkpoint to theclipinput of each of the two text nodes.A link is dragged with the mouse: from the dot on the right edge of one node to the dot on the left edge of another. This is how the text reaches the part of the model that can read it.
Write what you want to see
Fill in the
textfield of one of the two text nodes. For example: a quiet lake at dawn, mist, soft light.Leave the other empty or list in it what is not wanted: blur, distortion. Most models understand English best.
Add the blank
Add a Empty Latent Image node. Its
widthandheightfields set the size of the picture.The size follows the model. SD 1.5 was trained on pictures of 512 by 512, SDXL and the models built on it, Pony and Illustrious, on 1024 by 1024. At another size a model draws worse: it repeats figures and breaks the composition. The app tells you when the size is far from your model's.
The model does not draw on a clean sheet. It starts from noise of this size and removes it step by step.
Add the sampler
Add a KSampler node.
This is the main node of the graph: here noise becomes an image. Everything you have added so far meets in it.
Bring four links to the sampler
Connect to the inputs of KSampler:
- to
model, theMODELoutput of Load Checkpoint; - to
positive, the output of the node with your prompt; - to
negative, the output of the other text node; - to
latent_image, the output of Empty Latent Image.
If
positiveandnegativeare swapped, the model avoids what you described.- to
Turn the result into a picture
Add a VAE Decode node. Connect the sampler's output to its
samplesinput and theVAEoutput of Load Checkpoint to itsvaeinput.The sampler gives not a picture but its compressed form. This node unfolds it into pixels.
Save the picture
Add a Save Image node and connect the output of VAE Decode to its images input.
Without it ComfyUI works the picture out and puts it nowhere.
- 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 in the sampler:
seed: another number gives another picture from the same prompt;steps: more steps, a cleaner picture and a longer wait. 20-30 is usually enough;cfg: how strictly the model follows the text. Usually 5-8.
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 the model:
- a Load Checkpoint node.
ckpt_nameof Load Checkpoint holds a picture model (SD 1.5, SDXL, Pony, Illustrious, Flux and the like), not a video model; such a file lies inmodels/checkpoints, for examplejuggernautXL_v9.safetensors.
- Step 3, Add two texts:
- a CLIP Text Encode (Prompt) node.
- a CLIP Text Encode (Prompt) node.
- Step 4, Connect the texts to the model:
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).
- Step 5, Write what you want to see:
textof CLIP Text Encode (Prompt) (prompt) holds at least 3 characters and 2 real words.
- Step 6, Add the blank:
- a Empty Latent Image node.
- advice only, the step does not wait for it:
widthandheightof Empty Latent Image near the size the model chosen inckpt_nameof Load Checkpoint was trained at.
- Step 7, Add the sampler:
- a KSampler node.
- Step 8, Bring four links to the sampler:
MODELof Load Checkpoint intomodelof KSampler (a Load LoRA or LoraLoaderModelOnly in between is accepted).CONDITIONINGof CLIP Text Encode (Prompt) (prompt) intopositiveof KSampler.CONDITIONINGof CLIP Text Encode (Prompt) (negative prompt) intonegativeof KSampler.LATENTof Empty Latent Image intolatent_imageof KSampler.
- Step 9, Turn the result into a picture:
- a VAE Decode node.
LATENTof KSampler intosamplesof VAE Decode.VAEof Load Checkpoint intovaeof VAE Decode.
- Step 10, Save the picture:
- a Save Image or Preview Image node.
IMAGEof VAE Decode intoimagesof Save Image or Preview Image.
Mistakes people make
- positive and negative swapped: the picture avoids what you wrote.
CLIPconnected to only one text node.- Leaving the 512×512 default with an SDXL model: the lesson only advises the size of the chosen model under "Still to do" and does not hold the step back; use 1024×1024 for SDXL. See Resolution.
What next
These lessons go on from this one: Reading someone else's workflow, When the graph does not fit the graphics card, The prompt: how a model reads it, The sampler's settings, Refining with a second model, SDXL done properly, Choosing a sampler and a scheduler, Which loader for which file, A reference picture with IP-Adapter, Fixing faces and hands with a detailer, Two versions of a prompt with one switch, A picture from a picture, Upscaling with a model, ControlNet: drawing along the edges of a picture, LoRA for pictures, Removing a background, Music from text: ACE-Step 1.5, A sound from text: Stable Audio, A picture into a 3D model: Hunyuan3D 2, The same character in a new picture: FLUX.1 Kontext, The same face from one photo: IP-Adapter FaceID.