Beginner's Guide to AI Art Creation

Date: 2024-11-17 Categories: AI-generated imagery

The above is an AI drawing ComfyUI beginner tutorial made by Bilibili user 【醉石散客】. It is specifically designed as a beginner's guide for MAD creators. Starting with the most basic software installation, it will guide you step by step to become familiar with AI drawing, understand the principles and applications, and ultimately use the tools to create a MAD material that you are satisfied with.

For those who prefer not to watch videos, we have also prepared a text tutorial. Here it is:

1. ComfyUI Installation Method

There are currently two common installation methods: using the official integrated package and using Qiuyue's one-click launcher. Both installation methods are simple and quite similar.

If you're concerned about encountering various strange errors using the official integrated package, you can install the one-click launcher, which can help avoid some of these errors.

Qiuyue's launcher comes with built-in plugins and models, featuring a dedicated graphical interface. It also makes it easier to update versions and install plugins in the future. Below, I will demonstrate both installation methods, and you can choose one to complete the local deployment of ComfyUI.

1. Official Integrated Package Installation

Go to the official GitHub page to download, or download through the Baidu Cloud link we've prepared for you (contact me for the homepage link):

ComfyUI official download link: https://github.com/comfyanonymous/ComfyUI/releases

万字教程!奶奶看了都会的 ComfyUI 入门教程

After the download is complete, click on the folder to enter. You will see these folders, among which the "comfyui" folder is the root directory of the running program. The "update" folder is for version upgrades. The "run_cpu.bat" file below is for running ComfyUI using the CPU, and "run_nvidia_gpu.bat" is for running the ComfyUI interface using the GPU. You don't need to worry about the other files; just understand the roles of these folders:

万字教程!奶奶看了都会的 ComfyUI 入门教程

So, after completing the download of the installation package, you can directly run ComfyUI by double-clicking on "run_nvidia_gpu.bat" to start it.

万字教程!奶奶看了都会的 ComfyUI 入门教程

2. One-Click Launcher Installation

The one-click launcher by Qiuye is also quite straightforward; simply download the installation package (contact me for the homepage link). Its advantage lies in avoiding the code errors that may occur with the official integrated package, and it makes downloading node plugins a bit more convenient.

Open the root directory of ComfyUI, locate the launcher file, and simply double-click to start it:

万字教程!奶奶看了都会的 ComfyUI 入门教程

The UI interface of the ComfyUI launcher is consistent with that of the WebUI launcher, with only functional differences. Therefore, the installation of plugins and version upgrades will not be discussed here. Simply click on "One-Click Start" to proceed.

万字教程!奶奶看了都会的 ComfyUI 入门教程

2. How to Install Various Models

Note: The official integrated package and the one-click launcher operate in the same manner.

1. Standalone Model Installation

First, let’s talk about how to install large models, Lora, and other models in ComfyUI (using the official integrated package as an example).

Go to the root directory of ComfyUI, locate the "Models" folder, and double-click to enter it.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Once inside, you'll see folders named after different model types, such as Checkpoints (for large models), Loras, and ControlNet. Simply go into the corresponding folder and place the correct model files there.

万字教程!奶奶看了都会的 ComfyUI 入门教程

2. Shared Model Configuration

In addition to installing models independently in ComfyUI, it also supports sharing the same model folder with WebUI. The advantage is that you don’t need to reinstall models you’ve already installed, which also helps save disk space. This is a step everyone should learn.

Similarly, open the root directory of ComfyUI and locate the `extra_model_paths.yaml.example` file.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Open the file with Notepad, and then in Notepad, replace the path after `base_path` with the root directory of WebUI.

万字教程!奶奶看了都会的 ComfyUI 入门教程

The correct file path should look like this. After making the changes, simply press `Ctrl+S` to save the file.

万字教程!奶奶看了都会的 ComfyUI 入门教程

We’re not done yet. You also need to rename the file from `extra_model_paths.yaml.example` to `extra_model_paths.yaml`.

Exactly, just remove the `.example` suffix.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Then, start ComfyUI and check the model node to see if the models have been synchronized. If you followed my steps, the models should have been successfully synchronized, just like mine.

万字教程!奶奶看了都会的 ComfyUI 入门教程

3. Nodes in ComfyUI

Nodes are the core components of the ComfyUI workflow (similar to plugins in WebUI). They represent different operations and functions. Nodes can be samplers, models, prompts, etc. By connecting these nodes, we can create complex workflows. The configuration and connections between nodes directly affect the final output.

There are two types of nodes: official native nodes and user-developed custom nodes. These nodes together form the ComfyUI node workflow, allowing users to design and execute various complex processes based on Stable Diffusion. Next, I will provide a detailed introduction to these two types of nodes.

1. Native Nodes

The official native nodes are a series of basic nodes provided by the ComfyUI development team. They offer users a wide range of functions and tools to support image generation and other related tasks. Examples include sampler nodes, model nodes, prompt nodes, VAE nodes, and more.

万字教程!奶奶看了都会的 ComfyUI 入门教程

In simple terms, native nodes do not require any additional installation. Once ComfyUI is successfully installed, they are ready to use.

2. Custom Nodes

The strength of ComfyUI lies in its extensibility, allowing users to develop custom nodes according to their needs. Currently, community members from all over the world have contributed over 600 custom nodes (as of the data available in this tutorial), greatly enriching the design and optimization options for workflows.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Moreover, official native nodes and user-developed custom nodes can be combined to create highly customized workflows. Users can build the basic flow using official nodes and then add specific features or optimize existing processes with custom nodes.

Note: Custom nodes are similar to plugins in WebUI. Unlike native nodes, they require manual installation before use. Next, I will explain how to install custom nodes.

6. Custom Node Installation

The installation methods for custom nodes can be summarized into three types: official installation, launcher installation, and node manager (Manager) installation. Let me summarize them for you:

  1. Official Installation: This method has more steps and is more complicated, so it is not recommended.
  2. Launcher Installation: This method is simple and quick with fewer steps, but you need to close the running background process before installing. It can be used as an alternative installation option.
  3. Node Manager (Manager) Installation: No need to restart the background process; it’s ready to use immediately after installation, making it very convenient.

Now, I will introduce these three installation methods. These methods complement each other—while they are not mandatory, it’s important to understand them.

Note: Regardless of the installation method, custom node files are placed in the "custom_nodes" directory within ComfyUI.

万字教程!奶奶看了都会的 ComfyUI 入门教程

1. Official Installation

① Online Installation

First, you need to download an application called Git Configuration Manager. Here is the official download link: https://git-scm.com/download/win

You can also download it through the cloud storage link we’ve provided. After downloading, simply install it.

万字教程!奶奶看了都会的 ComfyUI 入门教程

After installation, go to the "custom_nodes" directory. In the file path, type "CMD" to bring up the command line. Then, enter the following command: `git clone [node repository URL]` (for example: `git clone https://github.com/ltdrdata/ComfyUI-Manager.git`), and press Enter to start the download (an internet connection is required). Wait for the download to complete.

Once the installation is complete, the node files you installed will appear in your "custom_nodes" folder, as shown in the image:

万字教程!奶奶看了都会的 ComfyUI 入门教程

This installation method might not be ideal for everyone—it’s not difficult but can be a bit troublesome. You may encounter errors during the process, but don’t worry. If you face any issues using this method, you can always switch to the local installation method.

② Local Installation

Go to the node’s code repository, download the compressed file, and then extract it into the "custom_nodes" directory. However, with this method, you won’t be able to update the node through online updates, so use it with caution.

万字教程!奶奶看了都会的 ComfyUI 入门教程

That’s the official installation method. If you’re using the official integrated package, you can install nodes using the two methods mentioned above. However, if you’re using the Qiuye Launcher, you won’t need to go through all these steps.

2. Launcher Installation

The launcher installation is very simple and straightforward: "Open the launcher — Click on Version Management — Click on Install New Extension — Search for the node name — Install." Just a few easy steps to complete.

万字教程!奶奶看了都会的 ComfyUI 入门教程

After installation, you can find the installed nodes in the "Extensions" section. For future updates, simply click on "One-Click Update," making it very convenient.

万字教程!奶奶看了都会的 ComfyUI 入门教程

If you're using the launcher, congratulations! The node installation method has been fully explained, and it’s really simple, right? If you don't want to waste time on tedious and painful installations, running ComfyUI through the launcher is your best choice.

3. Node Manager

Next, we have the most powerful one, which I’ve saved for last. There are two reasons for this:

  1. It is a custom node, so you need to first install it using any of the methods mentioned earlier.
  2. Once you have installed this node, the first two installation methods can be discarded.

So, this node manager is the "ComfyUI Manager."

ComfyUI Manager Introduction: ComfyUI Manager is a custom node tool that provides a range of management functions, including installing, removing, disabling, and enabling various custom nodes for ComfyUI.

万字教程!奶奶看了都会的 ComfyUI 入门教程

You can think of it as the "Extensions" in webUI. After installing "ComfyUI Manager," you can install and manage custom plugins just like in webUI extensions. It’s a very convenient way to install various custom plugins. Whether you’re using the “official integrated package” or the “launcher,” this is an essential node.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Note: For launcher users, the launcher has already installed many common plugins (including Manager), which means you don’t need to install Manager again.

So, how do you install this node? Think about it...

Yes, the examples of the first two installation methods are for the "ComfyUI Manager" custom node. So, you can use either of the first two installation methods to install "ComfyUI Manager." I won’t repeat the explanation here, just refer back to the previous installation steps for this plugin.

After installation, run ComfyUI, and you will find the "Manager" in the bottom right corner of the workspace.

万字教程!奶奶看了都会的 ComfyUI 入门教程

4. Chinese Localization Node Installation

1. AIGODLIKE Introduction

AIGODLIKE-ComfyUI-Translation is a multilingual translation plugin designed for ComfyUI, aimed at localizing the interface and functions of ComfyUI into different language environments. This plugin supports translation of elements like the persistent menu bar, search bar, right-click context menus, nodes, and more.

Node official address: [AIGODLIKE-ComfyUI-Translation on GitHub](https://github.com/AIGODLIKE/AIGODLIKE-ComfyUI-Translation)

Currently supported languages:

简体中文 (zh-CN)、繁体中文 (zh-TW)、英语 (English)、日语 (Japanese)、韩语 (Korean)

万字教程!奶奶看了都会的 ComfyUI 入门教程

2. Chinese Localization Node Installation

Open the Manager interface, and you will be able to install other nodes there. It may look a bit overwhelming (all in English), but don’t worry! Next, I’ll teach you how to use the "Manager" to install the Chinese localization plugin.

Click the "Install Custom Nodes" button, which translates to "安装自定义节点."

万字教程!奶奶看了都会的 ComfyUI 入门教程

In the search box in the top right corner, type "AIGODLIKE" and click "search."

Three custom nodes will appear below. The first one, "AIGODLIKE-COMFYUI-TRANSLATION," is the Chinese localization node we need to install. Click the "Install" button on the far right to install it (requires an internet connection).

万字教程!奶奶看了都会的 ComfyUI 入门教程

Then click "Restart" to restart ComfyUI. If you encounter installation failures, you’ll need to check your network (just a little hint).

万字教程!奶奶看了都会的 ComfyUI 入门教程

After installing the "AIGODLIKE" node, follow these steps: 1. Click the settings icon in the bottom right corner. 2. In the settings menu that pops up, find the "language" option. 3. Switch to the Chinese interface, and the localization will be applied immediately without needing to restart.

万字教程!奶奶看了都会的 ComfyUI 入门教程

3. Quick Language Switch

This plugin also supports quick language switching. For example, if you're currently using Simplified Chinese, you can click the "Switch Locale" button to instantly switch to English. Clicking it again will switch back to Chinese. Note: If you last switched to Traditional Chinese or Korean, clicking the button will directly toggle from those languages to English.

万字教程!奶奶看了都会的 ComfyUI 入门教程

After the detailed introduction of ComfyUI and the step-by-step installation of the node localization, everything is now ready.

Congratulations, you have officially stepped into the creative world of ComfyUI!

5. Text-to-Image Workflow Setup

Next, let's start setting up the ComfyUI workflow. I will guide you step by step to complete the text-to-image workflow.

Before that, we need to understand how to use shortcuts in the ComfyUI interface to help us operate more efficiently.

1. Shortcut Introduction

Here, we refer to the shortcuts provided by the official documentation. Official link: https://github.com/comfyanonymous/ComfyUI?tab=readme-ov-file

万字教程!奶奶看了都会的 ComfyUI 入门教程

The above shortcuts are the 20 official shortcuts (for Windows). For macOS users, the Ctrl key can be replaced with the Cmd key. I will point out which shortcuts will be used in the upcoming steps.

2. 6-Step Text-to-Image Workflow Setup

Next, I will guide you step by step to set up the text-to-image workflow through hands-on practice. You don't need to take notes or memorize those boring functions when you're just starting out because I believe that only by actually practicing can you master those functions and understand the role of each one. This is also my consistent teaching approach.

First, if you are starting the ComfyUI interface for the first time, your interface will have a default text-to-image workflow. Of course, if you have used ComfyUI before, it will automatically load the workflow you last used before closing the program.

万字教程!奶奶看了都会的 ComfyUI 入门教程

The workflow we are going to build next is this default text-to-image workflow. The goal is for everyone to set up the workflow themselves, so feel free to take a look in advance.

Then, click on the "Clear" button in the lower-left function area to delete the workflow nodes on the interface.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Step 1: Add the "K Sampler"

Right-click in the empty space of the workspace to bring up the node function area. Select "Sampling" -> "K Sampler." This will add a sampler node to our workspace.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Let me first introduce a few parameter settings in the "K Sampler":

The first parameter is the "random seed," which corresponds to the seed value in webUI. Each time a new image is generated, the seed value for that image will be displayed. The default value is 0.

The second parameter is "Post-run operation," which has four options: Fixed, Increase, Decrease, and Random.

These two parameters are used together. "Fixed" means the value of the image will be fixed, "Increase/Decrease" adds or subtracts 1 from the value, and "Random" means a random value will be generated. Those familiar with webUI should find this easy to understand. Typically, we use either "Fixed" or "Random."

万字教程!奶奶看了都会的 ComfyUI 入门教程

The "steps" refer to the iteration steps in webUI. Typically, this is set to around 30-40.

CGF corresponds to the prompt relevance in webUI. The larger the parameter, the closer the image result will be to the prompt. The smaller the parameter, the more freedom the AI has, and the image will deviate more from the prompt. Typically, it is set to around 10, with the default value being 8.

万字教程!奶奶看了都会的 ComfyUI 入门教程

The sampler is used in conjunction with the scheduler and corresponds to the sampling methods in webUI, such as the commonly used "dpm++_2m Karras."

The samplers generally use the optimized or latest samplers: euler_ancestral (abbreviated as euler a), dpmpp_2m series, and dpmpp_3m series.

Schedulers are generally set to normal or karras. If you're interested in their principles, you can look them up on GPT.

万字教程!奶奶看了都会的 ComfyUI 入门教程

The denoising parameter is generally left untouched. It corresponds to the iteration steps, and the default value of 1 is fine.

Second step, add "Load Large Model"

As shown in the image, simply drag the model connection point to bring up the function area, and then add the "Checkpoint Loader." Later, you can reuse this operation for adding other nodes without repeating the process here.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Step 3: Add "Forward and Reverse Prompts"

Add the forward prompt input node using the method described above, as shown in the image:

万字教程!奶奶看了都会的 ComfyUI 入门教程

The negative prompt input area can also be added in the same way by dragging the "Negative Condition" connection point.

However, here we demonstrate the copy-paste method. Select the "CLIP Text Encoder" node, press Ctrl+C to copy, then Ctrl+V to paste, and connect the two colored nodes together.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Alternatively, you can select the "CLIP Text Encoder" node, hold down the Alt key and drag with the left mouse button to duplicate the node. Feel free to try it out.

Fourth step, add "Image Size/Batch".

Drag the "Latent" connection point and select "Empty Latent" to add the "Image Size/Batch" node. This node has parameters for width, height, and batch size. These parameters should be self-explanatory for those familiar with webUI.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Step 5: Add "VAE Decoder"

Drag the "Latent" connection point and select "VAE Encoder" to add the VAE.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Step 6: Add the "Image Generation Area".

Drag the "Image" connection point and select "Preview Image" to successfully add the image generation area.

万字教程!奶奶看了都会的 ComfyUI 入门教程

At this point, all the nodes required for text-to-image generation have been successfully added. Now, we can click on "Add Prompt Queue" to perform a generation test. Before that, let's enter a prompt (such as "a girl") in the positive prompt input.

Note: "Add Prompt Queue" is the button for generating the image.

万字教程!奶奶看了都会的 ComfyUI 入门教程

If you click "Generate" like I did, you will encounter this error, as indicated by the red box in the image and the red markings on the nodes. The reason for this is that the highlighted nodes are not connected properly.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Next, we need to fix these error nodes and connect them properly. Pay attention to the color of the connection points. If the connection point is yellow, it should be connected to the corresponding yellow connection point (the names should match), as shown in the image:

万字教程!奶奶看了都会的 ComfyUI 入门教程

Now, click on generate again, and congratulations! This text-to-image workflow has been successfully set up.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Now, click on generate again, and congratulations! This text-to-image workflow has been successfully set up.

① The image generation area we added above is set to "Preview Image." As the name suggests, the generated image is in preview mode, and we need to manually save it. Right-click on the image and select "Save Image" to download it.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Yes, just like in webUI, where images are automatically saved to a local folder, this feature is available.

Delete the preview image, then drag "Latent" again and choose the "Save Image" node.

万字教程!奶奶看了都会的 ComfyUI 入门教程

So the images we generate next will automatically be saved to our local system. You can go to the "output" folder in the root directory of ComfyUI to check them, as shown in the image:

万字教程!奶奶看了都会的 ComfyUI 入门教程

② Currently, the VAE node we added is directly connected to the large model node. Some large models come with automatic VAE, while others do not. Can we manually add a VAE, like in webUI? Yes, we can.

Delete the connection line from the large model and drag at the VAE connection point. Then select "VAE Loader," and you'll see the familiar 840000 VAE.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Six, Workflow Reuse

By now, you should have a basic understanding of how to operate ComfyUI and generate images. Now, let's use the skills we've learned to create a super cool workflow in ComfyUI, as shown in the image below:

万字教程!奶奶看了都会的 ComfyUI 入门教程

I can understand how overwhelming it might feel at first! The numerous and complex nodes in ComfyUI can definitely seem intimidating. But don't worry, once you get used to the workflow and understand how each node functions, it'll start making more sense. Think of it as building a puzzle—each piece fits together to create a larger picture.

Don't worry, I didn't say you have to build this workflow yourself. In addition to its high flexibility and freedom, ComfyUI's biggest feature is that you can directly reuse workflows shared by others. With just a small file or an image, the entire workflow can be directly imported into our interface.

So now, I'll show you how to do it. Keep reading:

1. Save the workflow

First, let's save the workflow we have built.

Taking the text-to-image workflow we built earlier as an example, first click "Save" in the function area. Then, a pop-up will appear in your browser where you can name the file. After clicking "OK," the browser will download the file, which will be a `.json` file. This way, our workflow will be packaged into a single file.

万字教程!奶奶看了都会的 ComfyUI 入门教程

2. Loading a Workflow

Here are two common ways to load a workflow:

① We click on the "Load" option in the functionality area, then select the saved json file and click "Open." The workflow we saved for image generation will be loaded, and it's very simple.

万字教程!奶奶看了都会的 ComfyUI 入门教程

② Image Loading. The images generated by ComfyUI will include the workflow that generated them. This means we can directly load the workflow through the image itself.

There are two methods of operation. The first method is the same as the one above: click "Load," select the generated image, and open it. The workflow will be loaded.

Another method is to simply drag the generated image into the workspace, and the workflow will be loaded as well.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Please note that the workflow can only be loaded from an image generated by ComfyUI. Do not drag your own selfie into the workspace.

These are the two most common ways to load workflows. Of course, there are other methods, but I won’t go into them here. Aren’t these two enough for you to use?

3. Reusing Other Workflows

When you understand how to save/load workflows, do you know what I'm going to talk about next? That's right, ComfyUI (SD), as an open-source software, has many experts and developers sharing plugins, nodes, and of course, many workflows.

For instance, on the website OpenArt Flow | Builder, you will find a plethora of ready-to-use workflows, including model outfit changes, stylized portraits, photo restoration, and more. All we need to do is download these workflows, and they're ready for immediate use. I have personally curated a collection of several websites offering workflows and am willing to share them with everyone. Just give a triple combo (like, coin, favorite), and reach out to me via direct message to access these valuable resources.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Next, we will download a workflow and attempt to load it. As shown in the figure, an error occurred during the loading process, which is typically due to missing necessary nodes. To resolve this issue, we need to ensure that all dependent nodes are properly installed. This may involve installing specific plugins or updating existing nodes to the latest versions. Once all missing nodes are supplemented, the workflow should load and run smoothly.

Yes, the point you raised is crucial. Nodes indeed need to be downloaded and installed before they can be used, and when we reuse someone else's workflow, the nodes they used may not be installed in our local environment. Currently, there are over 600 nodes, and it's clear that we can't download and install all of them. Therefore, encountering missing node issues will be a common occurrence when using others' workflows. To address this problem, we need to check and install all necessary nodes before loading a workflow, or manually install missing nodes based on error prompts when the workflow fails to load. Although this may add some extra workload, it ensures the correctness and usability of the workflow.

万字教程!奶奶看了都会的 ComfyUI 入门教程

No problem! We have a solution. Remember the "ComfyUI Manager" node manager we installed earlier? With it, we can easily resolve this issue. Now, just follow along with the steps below.

Enable the manager, and you will see an option called "Install Missing Nodes." As the name suggests, that's the one.

万字教程!奶奶看了都会的 ComfyUI 入门教程

After opening it, you can see that I am missing 17 nodes. Therefore, it is necessary to install all these nodes (multiple nodes can be selected and installed simultaneously).

万字教程!奶奶看了都会的 ComfyUI 入门教程

After installing the 17 nodes, click refresh or restart the application backend (if the nodes still report errors), and then we can use this workflow normally.

万字教程!奶奶看了都会的 ComfyUI 入门教程

Thus concludes the introductory tutorial for ComfyUI from scratch.

7. Conclusion

In this ComfyUI tutorial, we have comprehensively explored the powerful capabilities and flexibility of this node-based image generation tool.

From basic introductions to in-depth operations, this tutorial has guided you step-by-step on how to efficiently use ComfyUI, covering all key steps from installation and model loading to node configuration. Additionally, it shared how to achieve a multilingual interface through the AIGODLIKE plugin, as well as how to quickly save, load, and reuse workflows. We believe you now have a comprehensive understanding of ComfyUI.

WeChatWeiboTwitterFacebookEmailCopy link