# Text to Image Workflow

## **1. Understanding the Text to Image Workflow**

#### start by clicking on ComfyUI, create a new ComfyUI workflow

<figure><img src="https://2219884424-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigAtVLBrlaI8jVruJfC8%2Fuploads%2Fyz8JEV3D2NZHndpR6sG1%2Fimage.png?alt=media&#x26;token=27740cbc-c6d2-4225-b865-3da4d6ba065b" alt=""><figcaption></figcaption></figure>

#### add the basic workflow for Text to Image

<figure><img src="https://2219884424-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigAtVLBrlaI8jVruJfC8%2Fuploads%2Fogyr5nnKeeI3XaxfU8TR%2F%25E6%2596%2587%25E7%2594%259F%25E5%259B%25BE.png?alt=media&#x26;token=6ee8481d-2b88-42b6-b022-3696b637a7f8" alt="Process of text-to-image workflow"><figcaption></figcaption></figure>

The workflow in ComfyUI is similar to that in Web UI:

<mark style="background-color:yellow;">**select a model → enter prompt → set parameters → generate image**</mark>

Parameters

<figure><img src="https://2219884424-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigAtVLBrlaI8jVruJfC8%2Fuploads%2FNqU8SCJN1rBd7qsIhnVS%2F%25E6%258E%25A7%25E5%2588%25B6%25E7%25A7%258D%25E5%25AD%2590.png?alt=media&#x26;token=f62554c6-9641-4458-83a1-dbcc3c0f83a6" alt="Text to Image Workflow - KSampler parameters"><figcaption></figcaption></figure>

> **control\_after\_generate:** control over seed generation
>
> **fixed:** fixing the seed
>
> **increment:** adding 1 from the existing seed
>
> **decrement:** subtracting 1 from the existing seed
>
> **randomize:** random seed

<figure><img src="https://2219884424-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigAtVLBrlaI8jVruJfC8%2Fuploads%2FgvA8WQ6bJuO5SSiicbaW%2F%25E8%25B0%2583%25E5%25BA%25A6%25E5%2599%25A8.png?alt=media&#x26;token=8b00ed52-035f-4c38-966d-470410f51db3" alt="Text to Image Workflow - scheduler parameters"><figcaption></figcaption></figure>

> **scheduler:** usually choose between normal or karras **denoise:** which indicates the strength of noise reduction in image generation, the higher the value, the greater the impact and change on the image

<figure><img src="https://2219884424-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigAtVLBrlaI8jVruJfC8%2Fuploads%2FywPcgo1xGoKdj3FK7GKn%2F%25E5%25B0%25BA%25E5%25AF%25B8.png?alt=media&#x26;token=b21a605c-86b9-43ab-a573-3e4a52621e35" alt="Text to Image Workflow - image size settings"><figcaption></figcaption></figure>

> **size recommendation:**&#x20;
>
> SD1.5: 512*512*&#x20;
>
> *SDXL: 1024*1024

## 2. How to add a node?

### **Add KSampler**

**First, add a core node: the KSampler**

* Right-click: <mark style="background-color:yellow;">**Add Node → sampling → KSampler**</mark>

<figure><img src="https://2219884424-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigAtVLBrlaI8jVruJfC8%2Fuploads%2FX3OuDKkanKzUAYNovEqW%2F%25E5%25BB%25BA%25E7%25AB%258B%25E9%2587%2587%25E6%25A0%25B7%25E5%2599%25A8.png?alt=media&#x26;token=c2b839b2-82e9-49ec-89e4-b3158826cb70" alt="Steps for adding KSampler" width="505"><figcaption></figcaption></figure>

### **Pull out** the node

#### **then pull out the sampler node and add the corresponding nodes**

<figure><img src="https://2219884424-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigAtVLBrlaI8jVruJfC8%2Fuploads%2FRcMelONM57SbLN9PiWCk%2F%25E6%258B%2589%25E5%2587%25BA.png?alt=media&#x26;token=024fbf8f-7563-4914-a957-fda8f60cce5f" alt="Text to Image Workflow - pull out the sampler node and add the corresponding nodes" width="460"><figcaption></figcaption></figure>

> model→CheckpointLoaderSimple&#x20;
>
> positive→CLIPTextEncode&#x20;
>
> negative→CLIPTextEncode&#x20;
>
> latent\_image→EmptyLatentImage&#x20;
>
> LATENT→VAEDecode&#x20;
>
> IMAGE→SaveImage

<figure><img src="https://2219884424-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigAtVLBrlaI8jVruJfC8%2Fuploads%2FIpyRdmpgpNkJprY8CdDW%2F%25E6%258B%2589%25E8%258A%2582%25E7%2582%25B9.png?alt=media&#x26;token=60ee0c7c-8a12-47d7-8ca3-c399eeee936f" alt="Text to Image Workflow - Steps of pulling out the node"><figcaption></figcaption></figure>

### **How to add LoRA?**

Loaders: mainly used for loading the diffusion model, including model and LoRA.

**Add Node→loaders→Load LoRA**

<figure><img src="https://2219884424-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigAtVLBrlaI8jVruJfC8%2Fuploads%2F291ZjYeEbgfUoMBWbX2Z%2F%25E5%258A%25A0%25E8%25BD%25BDlora.png?alt=media&#x26;token=56ef0665-b494-42e9-80ee-1519fee18961" alt="Steps to add LoRA"><figcaption></figcaption></figure>

### **How to add Clip Skip?**

Conditioning: guides the diffusion model to generate specific outputs, including Prompt, ControINet, Clip Skip, etc.

It is recommended to add Clip Skip to control the layers skipped, which helps adjust the final image details.

**Add Node→conditioning→CLIP Set Last Layer**

<figure><img src="https://2219884424-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigAtVLBrlaI8jVruJfC8%2Fuploads%2F8KKSqjWuB16ZZ5jzOOv2%2F%25E5%25B1%2582%25E7%25BA%25A7.png?alt=media&#x26;token=abc1cc87-d94a-4c83-a2d6-45251efe18ac" alt="Steps to add Clip Skip"><figcaption></figcaption></figure>

### **Connect nodes**

After adding nodes, many nodes might not be connected yet. They need to be connected in order according to the sequence and matching colors.&#x20;

**Checkpoint→LoRA→Clip Skip→Prompt→KSampler、Empty Latent Image→VAE Decode→Save Image**

<figure><img src="https://2219884424-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigAtVLBrlaI8jVruJfC8%2Fuploads%2F9LJmSBGMyU3a7SAUdcRs%2F%25E9%25A2%259C%25E8%2589%25B2%25E8%25BF%259E%25E7%25BA%25BF.png?alt=media&#x26;token=bfd38ca5-f53c-42f0-92a8-bdd5b7a23160" alt="Process to connect nodes"><figcaption></figcaption></figure>

<figure><img src="https://2219884424-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigAtVLBrlaI8jVruJfC8%2Fuploads%2FE9BP2iGThIdlQwD0DBKJ%2F%25E6%2590%25AD%25E5%25BB%25BA%25E5%25AE%258C%25E6%2588%2590.png?alt=media&#x26;token=7849e293-ae05-4ad8-8fe7-9f3d3c402338" alt="Steps to connect nodes"><figcaption></figcaption></figure>

### 3. Starting the Text to Image

#### Choose a Checkpoint

#### Select LoRA and adjust the weights

<figure><img src="https://2219884424-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigAtVLBrlaI8jVruJfC8%2Fuploads%2FapQloDVnLAob4sFFzMHS%2F%25E9%2580%2589lora%25E6%259D%2583%25E9%2587%258D.png?alt=media&#x26;token=357bcc63-1681-4df6-8d71-34dc5131cf71" alt="Text to image workflow - select LoRA and adjust the weights"><figcaption></figcaption></figure>

#### Set Clip Skip, typically choosing to set it to -2

<figure><img src="https://2219884424-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigAtVLBrlaI8jVruJfC8%2Fuploads%2FFi9onvbERAdNySa05Aoi%2F%25E5%25B1%2582%25E7%25BA%25A7%25E8%25B7%25B3%25E8%25BF%2587.png?alt=media&#x26;token=69293efb-bc7c-4fce-bbb0-e8959bc0d47a" alt="Text to image workflow - set Clip Skip"><figcaption></figcaption></figure>

#### Enter prompt

<figure><img src="https://2219884424-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigAtVLBrlaI8jVruJfC8%2Fuploads%2FqUzVj8kqA23YSCUYlArh%2F%25E6%258F%2590%25E7%25A4%25BA%25E8%25AF%258D.png?alt=media&#x26;token=9a1e7e45-a4e2-4da7-96ac-0fe71195eeed" alt="Text to image workflow - enter prompts" width="272"><figcaption></figcaption></figure>

#### Set relevant parameters

Since the SDXL model is chosen here, set the sampling steps to around <mark style="background-color:yellow;">40</mark>, and image size to <mark style="background-color:yellow;">1024\*1024</mark>

<figure><img src="https://2219884424-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigAtVLBrlaI8jVruJfC8%2Fuploads%2FKnQFRGKw5GH80iGeBsjy%2F%25E8%25AE%25BE%25E7%25BD%25AE%25E5%258F%2582%25E6%2595%25B0.png?alt=media&#x26;token=a17e2616-c3e4-4a92-920b-91d6420efaa8" alt="Text to image workflow - set relevant parameters"><figcaption></figcaption></figure>

#### Click Generate

<figure><img src="https://2219884424-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FigAtVLBrlaI8jVruJfC8%2Fuploads%2F48h1SWPcMzu5HCi6uCZm%2F%25E5%2588%259B%25E4%25BD%259C.png?alt=media&#x26;token=928911df-d29d-4256-8acb-64a1b7905b1d" alt="Text to image workflow - click the Generate button"><figcaption></figcaption></figure>

#### View the results
