ホーム 暮らし [For Beginners] Introduction to ComfyUI Portable ControlNet (Canny, SoftEdge, Depth, OpenPose + JSON Distribution)

[For Beginners] Introduction to ComfyUI Portable ControlNet (Canny, SoftEdge, Depth, OpenPose + JSON Distribution)

八木 麻衣 八木 麻衣 • 更新: • 公開: • 読了約 32 分
目次

1. Introduction

n8d37088aedf8

As you generate images with ComfyUI, you will increasingly find yourself wanting to perform fine-grained control, such as "I want to use only the composition as a reference," "I want to fix the pose," or "I want to preserve the atmosphere of the original image." ControlNet is the feature that meets these needs.

By using ControlNet, you can generate images while providing information such as outlines, 3D structures, and poses as conditions, allowing for more stable results than simple prompt-based generation. This article explains the features and proper usage of representative ControlNets—Canny, SoftEdge, Depth, and OpenPose—and provides the JSON files for reproducing each one.

Additionally, for OpenPose, we have prepared two types of workflows: "how to generate directly from a bone image" and "how to extract a skeleton from an existing image to generate." Furthermore, as an application example, we will introduce a practical case of swapping characters by combining Canny and LoRA.

2. Operating Environment (Author's PC)

For reference, here are the author's PC specifications.

  • CPU: Ryzen 5 5600X

  • GPU: GeForce RTX 4060

  • Memory: DDR4 32GB

  • OS: Windows 11

* The workflows in this article have been verified to work in the above environment.

3. What is ControlNet?

ControlNet is a mechanism that performs generation while providing image structure information as conditions.
Its greatest feature is the ability to stably reproduce compositions and poses that are difficult to replicate with prompts alone.
Representative control methods include Canny, which uses outlines; SoftEdge, which extracts soft outlines; Depth, which uses depth; and OpenPose, which specifies skeletons.

3-1. Downloading ControlNet Models

To use ControlNet, you need to download the corresponding ControlNet models and place them in the ComfyUI folder.

Since file names are often identical on HuggingFace, it can become difficult to distinguish them later, so we recommend renaming them to something easy to understand after downloading before placing them.

Here, we will introduce representative ControlNet models that can be used in an SDXL environment.

Canny
https://huggingface.co/diffusers/controlnet-canny-sdxl-1.0

Download the following file from 'Files and versions':
diffusion_pytorch_model.fp16.safetensors

Depth
https://huggingface.co/diffusers/controlnet-depth-sdxl-1.0

Download the following file from Files and versions: diffusion_pytorch_model.fp16.safetensors

OpenPose

https://huggingface.co/thibaud/controlnet-openpose-sdxl-1.0

Download the following file from Files and versions:
control-lora-openposeXL2-rank256.safetensors

SoftEdge

https://huggingface.co/SargeZT/controlnet-sd-xl-1.0-softedge-dexined

Download the following file from Files and versions:
controlnet-sd-xl-1.0-softedge-dexined.safetensors

Rename the downloaded models and place them in the following folder.

ComfyUI/models/controlnet

After placing them, restart ComfyUI to select the models from the ControlNetLoader node.

3-2. Preprocessors for ControlNet

When using ControlNet, you need a "preprocessor" to extract information such as outlines, depth, and skeletons from the original image. In ComfyUI, you can use them by installing the following extension.

If you are using ComfyUI Manager, you can easily install it by searching for "controlnet_aux" in the Manager.


After installation, restart ComfyUI to use various preprocessor nodes (Canny / SoftEdge / Depth / OpenPose, etc.).

3-3. Depth Model (Depth Anything)

When using Depth, you need a model that generates depth information. One representative model is "Depth Anything".

https://huggingface.co/LiheYoung/depth-anything-large-hf

If you are using ComfyUI Manager

If you are using ComfyUI Manager, the necessary models are automatically downloaded in most environments, so you basically do not need to place them manually.

If you are placing them manually

If you are placing the models manually, download the following files.

pytorch_model.bin

Place the downloaded files in the following folder.

ComfyUI/models/controlnet_aux

*If the folder does not exist, you can create it yourself without any issues.

4. Types of ControlNet and How to Use Them

4-1. Canny (Contour-based control)

Canny is a ControlNet that extracts the outlines of an image and generates a new image based on that composition. It is particularly effective when you want to change only the outfit or character while roughly maintaining the pose and composition of the original image. Because it only references the outlines, it offers high flexibility and works well with LoRA. It can be said to be the easiest ControlNet to handle for TRPG character portraits or character replacement purposes.

4-2. SoftEdge (Soft contour control)

SoftEdge is a ControlNet that uses softer edge information than Canny for generation. Since it maintains not only the outlines but also the shading and painting atmosphere to some extent, it is suitable when you want to preserve the texture of the original image. While it tends to produce a more natural finish than Canny, the constraint on the composition tends to be slightly weaker.

4-3. Depth (3D structure control)

Depth is a ControlNet that reproduces the 3D structure based on the depth information of the image. It is very effective when you want to stabilize the body orientation and camera angle, making it harder for the person's orientation and posture to collapse. However, since it strongly references the 3D structure, it is important to note that it is easily influenced by the body shape and outfit of the original image. It is suitable when you want to inherit not only the composition but also the overall shape to some extent.

4-4. OpenPose (Skeleton-based control)

OpenPose is a ControlNet that allows you to specify poses based on human skeleton information. Its biggest feature is that you can specify poses directly from skeleton images, like stick figures, even without an original image.
However, in an SDXL environment, the constraint on the pose may feel slightly weak. If you want to fix the pose more strictly, it is practical to apply OpenPose in SD1.5 to create the skeleton and then finish it in SDXL.

5. JSON Distribution & Loading

In this article, we are distributing JSON files that can reproduce the following ControlNet configurations. By dragging and dropping them into ComfyUI, you can load the same workflow as is.

・Workflow JSON for Canny

・Workflow JSON for SoftEdge

・Workflow JSON for Depth

・Workflow JSON for OpenPose (Bone image input)


・Workflow JSON for OpenPose (Skeleton extraction from image)

Since the models and LoRAs used vary depending on your environment, please adjust the Checkpoint and LoRA settings to match your own setup.

6. Generation examples for each ControlNet

You can check the differences in generation results by switching ControlNets while using the same source image.

Canny is suitable for replacing characters while strongly maintaining the composition and outlines.
SoftEdge extracts outlines somewhat softly, making it good at natural conversions that retain the atmosphere and texture of the original image.
Depth generates based on depth information, which has the characteristic of making it easier to stabilize body orientation and spatial structure.
OpenPose is effective when you want to strictly control poses, as it allows you to specify the human skeleton directly.

By using these selectively according to your purpose, you can make your generation results more stable.

6-1. Main ControlNet setting items

In ControlNet, you can mainly control the generation results by adjusting the following parameters.

Weight (Strength)

Adjusts the influence of ControlNet.
0.3 to 0.5
When you want to weaken the influence of the original image
0.6 to 0.8
Balanced
0.9 to 1.2
Strongly maintain the composition of the original image

It is easier to get natural results if you set it higher when you want to keep outlines like with Canny, and slightly lower when you want to emphasize the atmosphere like with SoftEdge.

Start / End

This is the range of generation steps to which ControlNet is applied.
Start = 0
End = 1
applies ControlNet from the beginning to the end of generation.
If you only want to fix the composition,
End = 0.6 to 0.8
allows for more freedom in the latter half of the generation.

Resolution

This is the resolution at which ControlNet analyzes image information.
512 to 1024 is common.
If it is too high, processing becomes heavy, and if it is too low, the structure is prone to collapsing.

6-2. Recommended settings for each ControlNet

Canny
Weight : 0.8 to 1.1
Start : 0
End : 1
Resolution : 512 to 768

Suitable for when you want to strongly maintain outlines. This is a setting that is easy to stabilize for purposes such as character replacement.

SoftEdge
Weight : 0.6-0.8
Start : 0
End : 0.8
Resolution : 512-768

You can convert images naturally while retaining the atmosphere of the original image.

Depth
Weight : 0.7-1.0
Start : 0
End : 1
Resolution : 768-1024

This is effective when you want to stabilize body orientation and depth information.

OpenPose
Weight : 0.9-1.2
Start : 0
End : 1
Resolution : 512

Use this when you want to maintain a pose accurately.

7. Two ways to use OpenPose

OpenPose is a ControlNet that allows you to specify poses based on human skeletal information.
It is used when you want to generate an image while maintaining a character's pose.
There are mainly two ways to use OpenPose.

7-1. Generating directly from bone images

With OpenPose, you can use a pre-prepared skeletal image as input and generate an image based on that pose.
This method is suitable for creating completely new poses because it does not depend on the original image and allows you to specify the pose solely from skeletal information.
For example,

・Bone images from pose material sites
・Skeletal images created for OpenPose

are used as input.
The features of this method are as follows:

・Not affected by the original image
・Allows complete specification of the pose
・High degree of freedom in composition

However, since only pose information exists, information such as body orientation and depth may sometimes depend on the model's inference.

7-2. Generating by extracting skeletons from images

This is a method of automatically extracting a skeleton from an existing image and reusing that pose for generation.
In this method, you first use the OpenPose preprocessor to extract skeletal information from the original image. By inputting that skeletal data into ControlNet, you can apply the same pose to a different character.
For example, it can be used for the following purposes:

・Reusing the pose of a favorite illustration
・Using the pose from a photograph for character generation
・Applying the pose of an existing character to a different character

The features of this method are as follows:

・Can use the pose of the original image as is
・High reproducibility of the pose
・Easy to stabilize the composition

However, if skeletal detection of the original image does not go well, the positions of arms and legs may collapse. In that case, using a different image or manually correcting the skeletal image may improve the results.

8. Summary

In this article, we explained the features and proper usage of Canny, SoftEdge, Depth, and OpenPose, and provided JSON files for reproducing each.
By using ControlNet, you can stably reproduce elements such as composition, poses, and depth that are difficult to achieve with prompts alone.
Start by trying relatively easy-to-use ControlNets like Canny or SoftEdge to better understand how they change the generated results. Once you get used to them, you can combine Depth and OpenPose to generate images that are closer to your original intent.
I hope this serves as a useful reference for building your own workflows using ControlNet.

9. Related Articles

Recommended articles to read next
Inpaint is essential if you want to fix distortions in faces, hands, accessories, etc.
This is the process to take your final quality to the next level.

⑦ Inpaint (Partial Correction)
https://note.com/like_badger8355/n/nfad3edb2d410

⑧ How to apply two types of LoRA simultaneously
https://note.com/like_badger8355/n/nf5579e517e04

Previous Articles

① How to install ComfyUI Portable
https://note.com/like_badger8355/n/ndf216fce9ab6

② Recommended startup settings by VRAM
https://note.com/like_badger8355/n/nab031e6f22d2

③ LoRA installation and upscaling procedure
https://note.com/like_badger8355/n/n5a3511cfcab7

④ High-resolution image generation workflow (Ultimate SD Upscale + FaceDetailer)
https://note.com/like_badger8355/n/n71306ca4f45a

⑤ i2i workflow to recreate characters while maintaining composition
https://note.com/like_badger8355/n/nadcf58caf08f

同じカテゴリの記事

八木 麻衣
トレンドリサーチャー 八木 麻衣
プロフィールを見る →

全記事の事実確認を担当。一次情報・公式発表・公開資料の三点を確認できない場合は公開を見送る判断をします。

おすすめの関連記事