Vous êtes sur la page 1sur 52

01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

ART DE DIFFUSION STABLE < HTTPS://STABLE-DIFFUSION-ART.COM/>

À quoi ressembleriez-vous après avoir utilisé ComfyUI pour de vrai.

Guide du débutant sur ComfyUI


69 666 vues

Mis à jour31 décembre 2023 · Par André · Classé comme tutoriel · Tagué ComfyUI , Txt2img ·
11 commentaires < https://stable-diffusion-art.com/comfyui/#comments>

ComfyUI est une interface graphique basée sur des nœuds pour la diffusion stable. Ce didacticiel s'adresse à
quelqu'un qui n'a jamais utilisé ComfyUI auparavant. je couvrirai

Texte en image
Image à image
Flux de travail SDXL
Peinture
Utiliser les LoRA
ComfyUI Manager – gestion des nœuds personnalisés dans l'interface graphique.

https://stable-diffusion-art.com/comfyui/ 1/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Impact Pack – une collection de nœuds ComfyUI utiles.

Apprenez la diffusion stable à partir de zéro !


Parfait pour les débutants
Cours pour débutants
Flux de travail réservés aux membres
Forums réservés aux membres
Supprimez la pub

Devenir membre

Contenus [ cacher ]

Qu’est-ce que ComfyUI ?


ComfyUI et AUTOMATIC1111
Où commencer?
Contrôles de base
Texte en image
Générer votre première image sur ComfyUI
1. Sélection d'un modèle
2. Entrez une invite et une invite négative
3. Générez une image
Que vient-il de se passer ?
Charger le nœud Checkpoint
Encodage de texte CLIP
Image latente vide
KSampler
Flux de travail image à image
Gestionnaire ComfyUI
Installation du gestionnaire ComfyUI
Utiliser ComfyUI Manager
Comment mettre à jour ComfyUI
Comment installer les nœuds personnalisés manquants
Comment mettre à jour les nœuds personnalisés
Rechercher des nœuds personnalisés
Montée en puissance
IA haut de gamme
Exercice : Recréer le flux de travail de mise à l'échelle de l'IA du texte à l'image
Correction haute résolution
SD Ultimate haut de gamme – édition ComfyUI
Installation du nœud haut de gamme SD Ultimate
Utilisation de SD Ultimate haut de gamme
ComfyUI Inpainting
Étape 1 : Ouvrez le flux de travail Inpaint
Étape 2 : Téléchargez une image
Étape 3 : Créer un masque Inpaint
Étape 4 : Ajuster les paramètres
Étape 5 : Générer l'inpainting
Flux de travail SDXL

https://stable-diffusion-art.com/comfyui/ 2/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Pack d'impact ComfyUI


Installer
Régénérer les visages avec Face Detailer (SDXL)
Régénérer les visages avec Face Detailer (SD v1.5)
Intégrations
LoRA
Flux de travail LoRA simples
Plusieurs LoRA
Raccourcis et astuces pour ComfyUI
Copier et coller
Déplacer plusieurs nœuds
Désactiver un nœud
Réduire un nœud
Générer une image
Flux de travail intégré
Réparer les graines pour gagner du temps
Exercice : Créer un workflow pour comparer avec et sans LoRA
Partage de paramètres entre deux nœuds
Workflow pour comparer des images avec et sans LoRA
Ressources utiles

VISITEZ NOTRE COMMANDITAIRE

Essayez LoRaMaker.ai - Générez des images illimitées et entraînez vos propres photos

Qu’est-ce que ComfyUI ?

ComfyUI est une interface graphique basée sur des nœuds pour la diffusion stable. Vous pouvez construire un
flux de travail de génération d'images en enchaînant différents blocs (appelés nœuds ) ensemble.

Certains blocs couramment utilisés sont le chargement d'un modèle de point de contrôle < https://stable-
diffusion-art.com/models/> , la saisie d'une invite, la spécification d'un échantillonneur, etc. ComfyUI
décompose un flux de travail en éléments réorganisables afin que vous puissiez facilement créer le vôtre.

Vous aurez besoin d’un ComfyUI fonctionnel pour suivre ce guide. Consultez le guide d'installation <
https://stable-diffusion-art.com/how-to-install-comfyui/> pour l'installation locale.

Check out Think Diffusion < https://www.thinkdiffusion.com/sda?via=inpost-install-comfyui> for a fully


managed ComfyUI online service. They offer 20% extra credits to our readers. (and a small commission to
support this site if you sign up)

ComfyUI vs AUTOMATIC1111

AUTOMATIC1111 < https://stable-diffusion-art.com/automatic1111/> is the de facto GUI for Stable


Diffusion.

https://stable-diffusion-art.com/comfyui/ 3/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Should you use ComfyUI instead of AUTOMATIC1111? Here’s a comparison.

The benefits of using ComfyUI are:

1. Lightweight: it runs fast.


2. Flexible: very configurable.
3. Transparent: The data flow is in front of you.
4. Easy to share: Each file is a reproducible workflow.
5. Good for prototyping: Prototyping with a graphic interface instead of coding.

The drawbacks of using ComfyUI are:

1. Inconsistent interface: Each workflow may place the nodes differently. You need to figure out what to
change.
2. Too much detail: Average users don’t need to know how things are wired under the hood. (Isn’t it the whole
point of using a GUI?)

Where to start?

The best way to learn ComfyUI is by going through examples. So, we will learn how to do things in ComfyUI in
the simplest text-to-image workflow.

We will go through some basic workflow examples. After studying some essential ones, you will start to
understand how to make your own.

At the end of this tutorial, you will have the opportunity to make a pretty involved one. The answer will be
provided.

Basic controls

Use the mouse wheel or two-finger pinch to zoom in and out.

Drag and hold the dot of the input or output to form a connection. You can only connect between input and
output of the same type.

Hold and drag with the left click to move around the workspace.

Press Ctrl-0 (Windows) or Cmd-0 (Mac) to show the Queue panel.

Text-to-image

Let’s first go through the simplest case: generating an image from text.

Classical, right?

By going through this example, you will also learn the idea before ComfyUI (It’s very different from
Automatic1111 WebUI < https://stable-diffusion-art.com/automatic1111/> ). As a bonus, you will know
more about how Stable Diffusion works < https://stable-diffusion-art.com/how-stable-diffusion-work/> !

https://stable-diffusion-art.com/comfyui/ 4/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Generating your first image on ComfyUI

After starting ComfyUI for the very first time, you should see the default text-to-image workflow. It should look
like this:

If this is not what you see, click Load Default on the right panel to return this default text-to-image workflow.

If you don’t see the right panel, press Ctrl-0 (Windows) or Cmd-0 (Mac).

You will see the workflow is made with two basic building blocks: Nodes and edges.

Nodes are the rectangular blocks, e.g., Load Checkpoint, Clip Text Encoder, etc. Each node executes some code.
If you have some programming experience, you can think of them as functions. Each node needs three things

Inputs are the texts and dots on the left that the wires come in.
Outputs are the texts and dots on the right the wires go out.

https://stable-diffusion-art.com/comfyui/ 5/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Parameters are the fields at the center of the block.

Edges are the wires connecting the outputs and the inputs between nodes.

That’s the whole idea! The rest are details.

Don’t worry if the jargon on the nodes looks daunting. We will walk through a simple example of using ComfyUI,
introduce some concepts, and gradually move on to more complicated workflows.

Below is the simplest way you can use ComfyUI. You should be in the default workflow.

1. Selecting a model

First, select a Stable Diffusion Checkpoint model < https://stable-diffusion-art.com/models/> in the Load
Checkpoint node. Click on the model name to show a list of available models.

https://stable-diffusion-art.com/comfyui/ 6/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

If the node is too small, you can use the mouse wheel or pinch with two fingers on the touchpad to zoom in and
out.

If clicking the model name does nothing, you may not have installed a model or configured it to use your
existing models in A1111. Go back to the installation guide < https://stable-diffusion-art.com/how-to-
install-comfyui/> to fix it first.

2. Enter a prompt and a negative prompt

You should see two nodes labeled CLIP Text Encode (Prompt). Enter your prompt in the top one and your
negative prompt in the bottom one.

The CLIP Text Enode node first converts the prompt into tokens and then encodes them into embeddings <
https://stable-diffusion-art.com/embedding/> with the text encoder.

https://stable-diffusion-art.com/comfyui/ 7/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

You can use the syntax (keyword:weight) to control the weight < https://stable-diffusion-art.com/prompt-
guide/#Keyword_weight> of the keyword. E.g. (keyword:1.2) to increase its effect. (keyword:0.8) to decrease its
effect.

Why is the top one the prompt? Look at the CONDITIONING output. It is connected to the positive input of the
KSampler node. The bottom one is connected to the negative, so it is for the negative prompt.

3. Generate an image

Click Queue Prompt to run the workflow. After a short wait, you should see the first image generated.

What has just happened?

The advantage of using ComfyUI is that it is very configurable. It is worth learning what each node does so you
can use them to suit your needs.

https://stable-diffusion-art.com/comfyui/ 8/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

You can skip the rest of this section if you are not interested in the theory.

Load Checkpoint node

Use the Load Checkpoint node to select a model. A Stable Diffusion model has three main parts:

1. MODEL: The noise predictor model in the latent space.


2. CLIP: The language model preprocesses the positive and the negative prompts.
3. VAE: The Variational AutoEncoder converts the image between the pixel and the latent spaces.

The MODEL output connects to the sampler < https://stable-diffusion-art.com/samplers/> , where the
reverse diffusion process is done.

The CLIP output connects to the prompts because the prompts need to be processed by the CLIP model before
they are useful.

https://stable-diffusion-art.com/comfyui/ 9/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

In text-to-image, VAE is only used in the last step: Converting the image from the latent to the pixel space. In
other words, we are only using the decoder part of the autoencoder.

CLIP Text Encode

The CLIP text encode node gets the prompt and feeds it into the CLIP language model. CLIP is OpenAI’s
language model, transforming each word in a prompt into embeddings < https://stable-diffusion-
art.com/embedding/> .

https://stable-diffusion-art.com/comfyui/ 10/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Empty latent image

A text-to-image < https://stable-diffusion-art.com/how-stable-diffusion-work/#Text-to-image> process


starts with a random image in the latent space.

The size of the latent image is proportional to the actual image in the pixel space. So, if you want to change the
size of the image, you change the size of the latent image.

You set the height and the weight to change the image size in pixel space.

Here, you can also set the batch size, which is how many images you generate in each run.

https://stable-diffusion-art.com/comfyui/ 11/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

KSampler

KSampler is at the heart of image generation in Stable Diffusion. A sampler < https://stable-diffusion-
art.com/samplers/> denoises a random image into one that matches your prompt.

KSampler refers to samplers implemented in this code repository < https://github.com/crowsonkb/k-


diffusion> .

Here are the parameters in the KSampler node.

Seed: The random seed value controls the initial noise of the latent image and, hence, the composition of the
final image.
Control_after_generation: How the seed should change after each generation. It can either be getting a
random value (randomize), increasing by 1 (increment), decreasing by 1 (decrement), or unchanged (fixed).
Step: Number of sampling steps. The higher, the fewer artifacts in the numerical process.

https://stable-diffusion-art.com/comfyui/ 12/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Sampler_name: Here, you can set the sampling algorithm. Read the sampler article < https://stable-
diffusion-art.com/samplers/> for a primer.
Scheduler: Controls how the noise level should change in each step.
Denoise: How much of the initial noise should be erased by the denoising process. 1 means all.

Image-to-image workflow

The Img2img < https://stable-diffusion-art.com/how-to-use-img2img-to-turn-an-amateur-drawing-to-


professional-with-stable-diffusion-image-to-image/> workflow is another staple workflow in Stable
Diffusion. It generates an image based on the prompt AND an input image.

You can adjust the denoising strength to control how much Stable Diffusion should follow the base image.

Download the image-to-image workflow <


https://comfyanonymous.github.io/ComfyUI_examples/img2img/img2img_workflow.png>

Drag and drop this workflow image to ComfyUI to load.

https://stable-diffusion-art.com/comfyui/ 13/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

To use this img2img workflow:

1. Select the checkpoint model.


2. Revise the positive and the negative prompts.
3. Optionally adjust the denoise (denoising strength) in the KSampler node.
4. Press Queue Prompt to start generation.

ComfyUI Manager

ComfyUI manager < https://github.com/ltdrdata/ComfyUI-Manager> is a custom node that lets you install
and update other custom nodes through the ComfyUI interface.

https://stable-diffusion-art.com/comfyui/ 14/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Installing ComfyUI Manager

To install this custom node, go to the custom nodes folder in the PowerShell (Windows) or Terminal (Mac) App:

cd ComfyUI/custom_nodes

And clone the node to your local storage.

git clone https://github.com/ltdrdata/ComfyUI-Manager

Restart ComfyUI completely.

Using ComfyUI Manager

After the installation, you should see an extra Manager button on the Queue Prompt menu. Clicking it shows a
GUI that lets you

Install/uninstall custom nodes.


Install missing nodes in the current workflow.
Install Models such as checkpoint models < https://stable-diffusion-art.com/models/> , AI upscalers <
https://stable-diffusion-art.com/ai-upscaler/> , VAEs < https://stable-diffusion-art.com/how-to-use-
vae/> , LoRA < https://stable-diffusion-art.com/train-lora/> , ControlNet models < https://stable-
diffusion-art.com/controlnet/> , etc.
Update ComfyUI UI.
Read the community manual.

https://stable-diffusion-art.com/comfyui/ 15/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

The Install Missing Nodes function is especially useful for finding what custom nodes that are required in the
current workflow.

The Install Custom Nodes menu lets you manage custom nodes. You can uninstall or disable an installed node
or install a new one.

https://stable-diffusion-art.com/comfyui/ 16/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

How to update ComfyUI

To update ComfyUI:

1. Click Manager in the Menu.


2. Click Update ComfyUI.
3. Restart ComfyUI completely.

How to install missing custom nodes

You may not have installed all the custom nodes you need in a workflow. After loading the workflow file, perform
the following steps to install missing custom nodes.

1. Click Manager in the Menu.


2. Click Install Missing custom Nodes.

https://stable-diffusion-art.com/comfyui/ 17/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

3. Restart ComfyUI completely.

How to update custom nodes

You can use ComfyUI manager to update custom nodes.

1. Click Manager in the Menu.


2. Click Fetch Updates. It may take a while to be done.
3. Click Install Custom nodes.
4. If an update is available, a new Update button will appear next to an installed custom node.
5. Click Update to update the node.

6. Restart ComfyUI.

https://stable-diffusion-art.com/comfyui/ 18/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

If this update process doesn’t work, you will need to use a terminal such as the PowerShell app (Windows) or the
Terminal app (Mac) to do a git pull.

1. Open the terminal.


2. cd to the custom node’s directory. Below is an example of going into the controlnet aux directory.

cd ComfyUI/custom_nodes/comfyui_controlnet_aux/

3. Do a git pull.

git pull

4. Restart ComfyUI.

Search custom nodes

Le menu Ajouter un nœud n'est peut-être pas le meilleur moyen de trouver un nœud personnalisé. Les choses
deviennent plus difficiles après avoir installé de nombreux nœuds personnalisés.

Vous pouvez double-cliquer sur n'importe quelle zone vide pour afficher un menu permettant de rechercher
des nœuds.

https://stable-diffusion-art.com/comfyui/ 19/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Montée en puissance

Il existe plusieurs façons de passer à l’échelle dans Stable Diffusion. À des fins pédagogiques, passons en revue la
mise à l'échelle avec

1. un upscaler d'IA < https://stable-diffusion-art.com/ai-upscaler/>


2. Correction haute résolution < https://stable-diffusion-art.com/automatic1111/#Hires_fix>
3. Haut de gamme ultime < https://stable-diffusion-art.com/controlnet-upscale/>

IA haut de gamme

Un upscaler IA < https://stable-diffusion-art.com/ai-upscaler/> est un modèle d'IA permettant d'agrandir


des images tout en remplissant les détails. Ce ne sont pas des modèles de diffusion stable mais des réseaux de
neurones entraînés à agrandir les images.

Chargez ce flux de travail de mise à l'échelle <


https://comfyanonymous.github.io/ComfyUI_examples/upscale_models/> en téléchargeant d'abord l'image
sur la page. Faites glisser et déposez l'image sur ComfyUI.

Astuce : Glisser-déposer une image réalisée avec ComfyUI charge le workflow qui la produit.

https://stable-diffusion-art.com/comfyui/ 20/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Dans cet exemple de base, vous voyez que les seuls ajouts au texte en image sont

Charger le modèle ascendant : ceci permet de charger un modèle ascendant d'IA. (Ce nœud se trouve dans
Ajouter un nœud > chargeurs )
Image haut de gamme (à l'aide du modèle) : Le nœud se situe désormais entre le décodeur VAE et le nœud
de sauvegarde de l'image. Il faut l'image et le modèle upscaler. Et génère une image agrandie. (Ce nœud se
trouve dans Ajouter un nœud > Image > mise à l'échelle )

Pour utiliser ce workflow d'upscaler, vous devez télécharger un modèle d'upscaler depuis Upscaler Wiki <
https://upscale.wiki/w/index.php?title=Model_Database&oldid=1571> et le placer dans le dossier models
> upscale_models .

Vous pouvez également configurer ComfyUI pour utiliser les fichiers de modèle d'AUTOMATIC1111 <
https://stable-diffusion-art.com/how-to-install-
comfyui/#Sharing_models_between_AUTOMATIC1111_and_ComfyUI> .

Sélectionnez un upscaler et cliquez sur Queue Prompt pour générer une image mise à l'échelle. L'image aurait
dû être mise à l'échelle 4x par l'upscaler AI.

Exercice : Recréer le flux de travail de mise à l'échelle de l'IA du texte à l'image

C'est un bon exercice de créer votre premier flux de travail personnalisé en ajoutant un upscaler au flux de travail
texte-image par défaut.

1. Revenez au flux de travail de base de texte en image en cliquant sur Load Default .

2. Cliquez avec le bouton droit sur un espace vide près de Enregistrer l'image. Sélectionnez Ajouter un nœud >
chargeurs > Charger un modèle haut de gamme.

https://stable-diffusion-art.com/comfyui/ 21/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

3. Cliquez sur le point sur le fil entre VAE Decode et Save Image . Cliquez sur Supprimer pour supprimer le fil.

https://stable-diffusion-art.com/comfyui/ 22/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

4. Cliquez avec le bouton droit sur un espace vide et sélectionnez Ajouter un nœud > image > mise à l'échelle >
Améliorer l'image (à l'aide du modèle) pour ajouter le nouveau nœud.

https://stable-diffusion-art.com/comfyui/ 23/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

5. Faites glisser et maintenez la sortie UPSCALE_MODEL de Load Upscale Model . Déposez-le sur
upscale_model du nœud Upscale Image (using Model) .

6. Drag and hold the IMAGE output of the VAE Decode. Drop it at the image input of the Upscale Image
(using Model).

https://stable-diffusion-art.com/comfyui/ 24/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

7. Drag and hold the IMAGE output of the Upscale Image (uisng Model) node. Drop it at the images input of
the Save Image node.

8. Click Queue Prompt to test the workflow.

Now you know how to make a new workflow. This skill comes in handy to make your own workflows.

Hi-res fix

Download the first image on this page <


https://comfyanonymous.github.io/ComfyUI_examples/2_pass_txt2img/> and drop it in ComfyUI to load
the Hi-Res Fix workflow.

This is a more complex example but also shows you the power of ComfyUI. After studying the nodes and edges,
you will know exactly what Hi-Res Fix is.

https://stable-diffusion-art.com/comfyui/ 25/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

The first part is identical to text-to-image: You denoise a latent image using a sampler, conditioned with your
positive and negative prompts.

The workflow then upscales the image in the latent space and performs a few additional sampling steps. It adds
some initial noise to the image and denoises it with a certain denoising strength.

https://stable-diffusion-art.com/comfyui/ 26/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

The VAE decoder then decodes the larger latent image to produce an upscaled image.

SD Ultimate upscale – ComfyUI edition

SD Ultimate upscale < https://stable-diffusion-art.com/controlnet-


upscale/#Method_3_ControlNet_tile_upscale> is a popular upscaling extension for AUTOMATIC1111 <
https://stable-diffusion-art.com/automatic1111/> WebUI. You can use it on ComfyUI too!

Github Page of SD Ultimate upscale for ComfyUI <


https://github.com/ssitu/ComfyUI_UltimateSDUpscale>

This is also a good exercise for installing a custom node.

https://stable-diffusion-art.com/comfyui/ 27/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Installing the SD Ultimate upscale node

To install this custom node, go to the custom nodes folder in the PowerShell (Windows) or Terminal (Mac) App:

cd ComfyUI/custom_nodes

And clone the node to your local storage.

git clone https://github.com/ssitu/ComfyUI_UltimateSDUpscale --recursive

Restart ComfyUI completely.

Using SD Ultimate upscale

A good exercise is to start with the AI upscaler workflow <


https://comfyanonymous.github.io/ComfyUI_examples/upscale_models/esrgan_example.png> . Add SD
Ultimate Upscale and compare the result.

Load the AI upscaler workflow by dragging and dropping the image to ComfyUI or using the Load button to
load.

Right-click on an empty space. Select Add Node > image > upscaling > Ultimate SD Upscale.

https://stable-diffusion-art.com/comfyui/ 28/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

You should see the new node Ultimate SD Upscale. Wire up its input as follows.

image to VAE Decode’s IMAGE.


model to Load Checkpoint’s MODEL.
positive to CONDITIONING of the positive prompt box.
negative to CONDITIONING of the negative prompt box.
vae to Load Checkpoint’s VAE.
upscale_model to Load Upscale Model’s UPSCALE_MODEL.

For the output:

IMAGE to Save Image’s images.

https://stable-diffusion-art.com/comfyui/ 29/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

If they are wired correctly, clicking Queue Prompt should show two large images, one with the AI upscaler and
the other with Ultimate Upscale.

You can download this workflow example below. Drag and drop the image to ComfyUI to load.

Ultimate Upscale workflow < https://stable-diffusion-art.com/wp-


content/uploads/2023/09/ComfyUI_Ultimate_upscale_workflow.png>

ComfyUI Inpainting

You can use ComfyUI for inpainting < https://stable-diffusion-art.com/inpainting_basics/> . It is a basic


technique to regenerate a part of the image.

I have to admit that inpainting is not the easiest thing to do with ComfyUI. But here you go…

https://stable-diffusion-art.com/comfyui/ 30/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Step 1: Open the inpaint workflow

Download the following inpainting workflow. Drag and drop the JSON file to ComfyUI.

Download < https://stable-diffusion-art.com/wp-content/uploads/2023/12/inpaint-sd-


model.json>

Step 2: Upload an image

Pick an image that you want to inpaint.

Andy Lau is ready for inpainting.

You can download the image in PNG format here.

Download < https://stable-diffusion-art.com/wp-


content/uploads/2023/09/andylau_png24.png>

Upload it to the workflow.

https://stable-diffusion-art.com/comfyui/ 31/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Step 3: Create an inpaint mask

Right-click the image. Select Open in MaskEditor in the context menu.

https://stable-diffusion-art.com/comfyui/ 32/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Mask the area you want to regenerate.

https://stable-diffusion-art.com/comfyui/ 33/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Click Save to node.

Step 4: Adjust parameters

Select a Checkpoint model. Note that an inpainting model doesn’t work with the workflow.

Change the prompt:

a man wearing sunglasses, epic style, super hero, highly detailed

The original denoising strength (denoise) is too high. Set it to 0.6.

Step 5: Generate inpainting

Finally, press the Queue Prompt to perform inpainting.

https://stable-diffusion-art.com/comfyui/ 34/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

SDXL workflow

https://stable-diffusion-art.com/comfyui/ 35/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Simple SDXL workflow.

Because of its extreme configurability, ComfyUI is one of the first GUIs that made the Stable Diffusion XL model
< https://stable-diffusion-art.com/sdxl-model/> work.

Download the following SDXL workflow for ComfyUI. Drag and drop the image to ComfyUI to load.

Download < https://stable-diffusion-art.com/wp-content/uploads/2023/12/sdxl-


workflow.json>

You will need to change

Positive Prompt
Negative Prompt

https://stable-diffusion-art.com/comfyui/ 36/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

That’s it!

There are a few more complex SDXL workflows on this page <
https://comfyanonymous.github.io/ComfyUI_examples/sdxl/> .

ComfyUI Impact Pack

ComfyUI Impact pack < https://github.com/ltdrdata/ComfyUI-Impact-Pack> is a pack of free custom nodes


that greatly enhance what ComfyUI can do.

There are more custom nodes in the Impact Pact than I can write about in this article. See the official tutorials <
https://github.com/ltdrdata/ComfyUI-extension-tutorials/tree/Main> to learn them one by one. Read
through the beginner tutorials if you want to use this set of nodes effectively.

Install

To install the ComfyUI Impact Pack, first open the PowerShell App (Windows) or the Terminal App (Mac or
Linux).

cd custom_nodes

Clone the Impact Pack to your local storage.

git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack.git

Clone Workflow Component that is needed for Impact Pack.

git clone https://github.com/ltdrdata/ComfyUI-Workflow-Component

Restart ComfyUI completely.

Regenerate faces with Face Detailer (SDXL)

ADetailer < https://stable-diffusion-art.com/adetailer/> is an AUTOMATMIC1111 extension that fixes faces


using inpainting automatically. The counterpart in ComfyUI is the Face Detailer (also called DDetailer). It is
included in the Impact Pack.

You can use this workflow < https://github.com/ltdrdata/ComfyUI-extension-


tutorials/blob/Main/ComfyUI-Impact-Pack/workflow/sdxl-detailer.json> in the Impact Pack to regenerate
faces with the Face Detailer custom node and SDXL base and refiner models. Download and drop the JSON file
into ComfyUI.

Download < https://stable-diffusion-art.com/wp-content/uploads/2023/12/sdxl-


detailer.json>

To use this workflow, you will need to set

The initial image in the Load Image node.


An SDXL base model in the upper Load Checkpoint node.

https://stable-diffusion-art.com/comfyui/ 37/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

An SDXL refiner model in the lower Load Checkpoint node.


The prompt and negative prompt for the new images.

Click Queue Prompt to start the workflow.

Andy Lau’s face doesn’t need any fix (Did he??). So I used a prompt to turn him into a K-pop star.

a closeup photograph of a korean k-pop star man

Only the face changes, while the background and everything else stays the same.

Regenerate faces with Face Detailer (SD v1.5)

The following is an example of text-to-image workflow using the Face Detailer to automatically fix faces. It is a
v1.5 workflow.

https://stable-diffusion-art.com/comfyui/ 38/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Download < https://stable-diffusion-art.com/wp-content/uploads/2023/12/ComfyUI-


Face-Detailer-txt2img.json>

Inpainting with ControlNet provides extra consistency by following the original content. Here’s an example of a
text-to-image workflow using Face Detailer with ControlNet Tile.

Download < https://stable-diffusion-art.com/wp-content/uploads/2023/12/ComfyUI-


Impact-Pack-Face-Detailer-ControlNet-txt2img.json>

Embeddings

To use embeddings < https://stable-diffusion-art.com/embedding/> in ComfyUI, type embedding: in the


positive or the negative prompt box. A list a available embeddings should appear. Select the one you want to
use.

https://stable-diffusion-art.com/comfyui/ 39/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

After the selection, it is used like the following in the prompt box.

embedding:BadDream

LoRA

LoRA < https://stable-diffusion-art.com/lora/> is a small model file modifying a checkpoint model <
https://stable-diffusion-art.com/models/> . It is frequently used for modifying styles or injecting a person
into the model.

In fact, the modification of LoRA is clear in ComfyUI:

https://stable-diffusion-art.com/comfyui/ 40/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

The LoRA model changes the MODEL and CLIP of the checkpoint model but leaves the VAE untouched.

Simple LoRA workflows

This is the simplest LoRA workflow possible: Text-to-image with a LoRA and a checkpoint model.

Download the simple LoRA workflow <


https://comfyanonymous.github.io/ComfyUI_examples/lora/lora.png>

https://stable-diffusion-art.com/comfyui/ 41/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

To use the workflow:

1. Select a checkpoint model.


2. Select a LoRA.
3. Revise the prompt and the negative prompt.
4. Click Queue Prompt.

Multiple LoRAs

You can use two LoRAs in the same text-to-image workflow.

Download the two-LoRA workflow <


https://comfyanonymous.github.io/ComfyUI_examples/lora/lora_multiple.png>

The usage is similar to one LoRA, but now you must pick two.

https://stable-diffusion-art.com/comfyui/ 42/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

The two LoRAs are applied one after the other.

Shortcuts and Tricks for ComfyUI

Copy and paste

Select a node and press Ctrl+C to copy.

Ctrl+V to paste.

Ctrl+Shift+V to paste with input connections intact.

Moving multiple nodes

Create a group to move a set of nodes together.

Alternatively, hold down Ctrl and drag to create a box to select multiple nodes. You can also hold down Ctrl to
select multiple nodes.

To move them, hold down Shift and move the mouse.

Mute a node

You can temporarily disable a node by muting it. Select a node and press Ctrl+M to node a node.

There’s no keyboard shortcut to mute a group. You can select Bypass Group Node in the right-click menu to
bypass it. Or mute the first node in the group to disable it.

Minimize a node

Clicking the dot on the top left corner of the node minimizes it.

Generate image

Press Ctrl+Enter to put the workflow in the queue and generate images.

Embedded workflow

ComfyUI saves the whole workflow in the metadata of the PNG file it saves. To load the workflow, drag and drop
the image to ComfyUI.

Fix seeds to save time

ComfyUI only reruns a node if the input changes. If you are working on a long chain of nodes, you can save time
from regenerating the upstream results by fixing the seeds.

https://stable-diffusion-art.com/comfyui/ 43/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Exercise: Make a workflow to compare with and without LoRA

To be good at ComfyUI, you really need to make your own workflows.

A good exercise is to create a workflow to compare text-to-image with and without a LoRA while keeping
everything else the same.

To achieve this, you need to know how to share parameters between two nodes.

Sharing parameters between two nodes

Let’s use the same seed in two K-Samplers.

They have their own seed values. To use the same seed value between the two, right-click on the node and select
convert seed to input.

https://stable-diffusion-art.com/comfyui/ 44/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

You should get a new input node called seed.

Right-click on an empty space. Select Add node > utils > Primitive. Connect the primitive node to the two seed
inputs.

https://stable-diffusion-art.com/comfyui/ 45/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Now, you have a single seed value sharing between the two samplers.

Workflow to compare images with and without LoRA

Using this technique alone, you can modify the single LoRA <
https://comfyanonymous.github.io/ComfyUI_examples/lora/lora.png> example to make a workflow
comparing the effect of LoRA while keeping everything else the same.

https://stable-diffusion-art.com/comfyui/ 46/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Comparing the effect of Epilson offset LoRA. Top: with LoRA. Bottom: without LoRA.

You can download the answer below.

ComfyUI_workflow_compare_with_and_without_Lora < https://stable-diffusion-art.com/wp-


content/uploads/2023/09/ComfyUI_workflow_compare_with_and_without_Lora.png>

Download < https://stable-diffusion-art.com/wp-


content/uploads/2023/09/ComfyUI_workflow_compare_with_and_without_Lora.png>

Useful resources

Official ComfyUI tutorial < https://comfyanonymous.github.io/ComfyUI_tutorial_vn/> – A graphical


tutorial. Very basic.

ComfyUI Examples < https://comfyanonymous.github.io/ComfyUI_examples/> – A bunch of example


workflows you can download.

ComfyUI Community Manual < https://blenderneko.github.io/ComfyUI-docs/> – A reference manual.

https://stable-diffusion-art.com/comfyui/ 47/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

By Andrew
Andrew is an experienced engineer with a specialization in Machine Learning and Artificial
Intelligence. He is passionate about programming, art, photography, and education. He has
a Ph.D. in engineering.

11 comments

Aleks
December 25, 2023 at 2:55 pm

I’m surprised you didn’t mention inpaint masking inside of comfyUI itself, if you right click on the loaded image,
you can open the mask editor and mask it there, so you don’t really need to use an external program, The
downside is that doing so you can’t zoom so on small images or hires monitors it can be a bit tedious to mask
things well. Also surprised there’s no any coverage on outpainting, which can also be achieved internally.

Some advice on inpainting is that it tends to work better on moderate sized or larger portions, small areas it will
struggle generally speaking. I’ll double check later if the mask editor is part of a custom node pack but I believe
that’s base.

no
December 19, 2023 at 11:24 pm

Cool. A little bird told me that I could train lora files with ComfyUI. How do I do that? I have my sample images
ready to go. I’m not able to use Dreambooth or Kohya. What do I do?

Andrew < https://stable-diffusion-art.com>


December 20, 2023 at 7:48 am

These two tutorials use Google colab:


https://stable-diffusion-art.com/dreambooth/ < https://stable-diffusion-art.com/dreambooth/>
https://stable-diffusion-art.com/train-lora/ < https://stable-diffusion-art.com/train-lora/>

dekay

https://stable-diffusion-art.com/comfyui/ 48/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

November 17, 2023 at 6:23 pm

Thanks for all the informations…this manuals is very helpful!


Great…

Andrew < https://stable-diffusion-art.com>


November 19, 2023 at 8:56 am

happy diffusing!

Joe
November 9, 2023 at 11:32 am

>To use embeddings in ComfyUI, type embedding: in the positive or the negative prompt box. A list a available
embeddings should appear.

Nope. Nothing appears but my text, “embedding:” even with all the recommended and “missing” custom nodes
from this tutorial.

Aleks
December 25, 2023 at 3:06 pm

This is part of a Custom node in the customScripts project. It can be found on github

user: pythongosssss
Project name: ComfyUI-Custom-Scripts
Also if you have the ComfyUI manager it can be installed through that. It will not always find the embeddings,
the two models I work with most it doesn’t find them, but a lot of them it does. so mileage may vary.

chris
October 4, 2023 at 8:38 am

Just wanted to say a big thank you for this guide which helped me the most with starting comfyui!

Andrew < https://stable-diffusion-art.com>

https://stable-diffusion-art.com/comfyui/ 49/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

October 5, 2023 at 10:43 am

Happy diffusing ?

woshitoutouge
October 25, 2023 at 9:08 am

Great content for beginners. really make things easy. Thanks a lot

Nyeinchanwin
December 4, 2023 at 3:38 am

How do I save the ControlNet images and Output images from video2video workflow?

Subscribe!
Get updates on the latest tutorials, prompts, and exclusive content.

Enter your email address to subscribe*

E-MAIL

S'ABONNER

Bienvenue chez Stable Diffusion Art ! Nous voulons rendre l’IA à diffusion stable accessible à tous.
Vous trouverez ici des tutoriels et des ressources pour vous aider à utiliser cette technologie
transformatrice.

Derniers articles

Vidéo de personnages rapide et cohérente avec Face Fix (ComfyUI) <


https://stable-diffusion-art.com/fast-consistent-character-video2video/>

https://stable-diffusion-art.com/comfyui/ 50/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

Comment changer l'arrière-plan dans Stable Diffusion < https://stable-diffusion-


art.com/change-background/>

Générateur d'enfants (ComfyUI) < https://stable-diffusion-art.com/child-generator-


comfyui/>

< https://andrewongai.gumroad.com/l/stable_diffusion_prompt_generator>

Générateur d'invites pour une diffusion stable <


https://andrewongai.gumroad.com/l/stable_diffusion_prompt_generator>

< https://andrewongai.gumroad.com/l/beginners-guide-to-stable-diffusion-ebook>

Livre électronique Guide du débutant <


https://andrewongai.gumroad.com/l/beginners-guide-to-stable-
diffusion-ebook>

ART DE DIFFUSION STABLE < HTTPS://STABLE-DIFFUSION-ART.COM/>


© Sagio Development LLC, 2023. Tous droits réservés.

https://stable-diffusion-art.com/comfyui/ 51/52
01/01/2024 01:33 Guide du débutant sur ComfyUI - Art de diffusion stable

< https://www.addtoany.com/share>

https://stable-diffusion-art.com/comfyui/ 52/52

Vous aimerez peut-être aussi