Overview

12 Using ControlNets

This chapter explains how ControlNets let image generation models follow a reference image much more closely than prompting alone can achieve. It introduces the idea that a ControlNet uses an input image with a specific structure to guide the final output, and shows how ComfyUI can be extended with custom nodes installed through the Manager to make these workflows easier. The chapter also emphasizes using Stable Diffusion 1.5 for these examples because it offers a rich selection of ControlNets and can still produce impressive results on modest hardware.

The first practical example uses the QR Code ControlNet to create a hidden image embedded inside a generated scene. Because this ControlNet does not require preprocessing, it serves as a simple entry point into the workflow: load the controlnet model, provide a high-contrast reference image, and generate a new image that subtly contains the hidden shape while still matching the text prompt. The result demonstrates how control strength can make the hidden form more or less visible without destroying the visual coherence of the picture.

The later examples show how preprocessing expands what ControlNets can do. Scribble uses an outline-extraction node to stylize a real photo into anime while preserving the original structure, Open Pose uses pose estimation to recreate a specific body position in a completely different character and setting, and Semantic Segmentation captures the overall composition of a scene while allowing major stylistic and content changes. Taken together, these examples show that ControlNets provide a practical way to control pose, structure, and composition with far more precision than text prompts alone, even fixing common diffusion issues like extra limbs or awkward anatomy.

Basic structure of a control net workflow.
Examples of the reference images we’ll need in this chapter
Controlnet workflow with a preprocessor.
Controlnet workflow with a preprocessor.
Searching for the ControlNet Aux nodes
ControlNet Aux versions
ComfyUI must be restarted for the newly installed nodes to be available
General ComfyUI workflow for ControlNets
The ControlNet portion of our QR Code work flow is straightforward
The muted horn symbol will appear ‘hidden’ in our final image thanks to the controlnet
Loading our reference image in the actual ComfyUI workflow
The hidden symbol is visible when you look at the picture farther away.
Increasing the controlnet strength makes the hidden image more visible.
Image of Crowmeo at my balcony.
We definitely don’t want to create this reference image by hand.
Using the AnyLine Lineart preprocessing node and viewing the results with Preview Image.
Our Anime style Crowmeo!
Our Anime style Crowmeo with the appropriate number of legs!
Statue of Patanjali meditating (attribution: Wikipedia user Alokprasad)
Our workflow extracting the pose from our image.
Pose reference image for the Open Pose controlnet
We can control which parts of the pose we’d like to extract.
We have a completely different image but using the exact pose of Patanjali.
The cherry blossoms in Seattle in the spring can be a sight to behold!
The segmentor has determined which objects occupy which parts of our scene.
Though the images look very different they share the same composition

Summary

  • ControlNets are a type of model that allows us to use a reference image to control the output of a model.
  • In some cases the reference image can be created by hand, but more often than not we need a special preprocessor to create the correct reference image from an original source image.
  • ComfyUI Controlnet Aux is a collection of custom nodes that can be downloaded from within the ComfyUI Manager interface.
  • The QR Code controlnet was designed to embed QR Codes into images, but can also be used to create interesting “hidden” images in our output and requires no special preprocessing node.
  • The Scribble control net takes an outline of an image and ensures that Stable Diffusion sticks to that outline.
  • The Anyline Lineart node makes it easy to extract outlines from existing images.
  • Open Pose is a controlnet that allows you to use the DWPose estimator preprocessor to determine the pose a character is in in a source photo and ensure the model generates an image according to this pose.
  • Semantic Segmentation is a combination of preprocessor and controlnet that allows us to understand and generate images based on the composition of an image in terms of the types of objects in each section.
  • The use of ControlNets allows us to greatly extend the capabilities of even Stable Diffusion 1.5 (as well as SDXL and Flux) allowing us to ensure the image generated follows precisely the structure we want it to.

FAQ

What are ControlNets and why would I use them?ControlNets are separate models that give you much more precise control over image generation than prompting alone. They can guide things like hidden image details, style transfer, pose, and scene composition.
How does a ControlNet workflow work in ComfyUI?A ControlNet workflow typically takes a reference image and your text prompts, passes them through the ControlNet, and then continues through the rest of the normal ComfyUI generation pipeline. The main difference is that the ControlNet helps steer the output based on the reference image.
Why do many ControlNets require image preprocessing?Many ControlNets need the reference image converted into a special format, such as outlines, pose skeletons, or segmentation maps. A preprocessor node automates this conversion so you do not have to create the control image manually.
How do I install ControlNet Aux preprocessors in ComfyUI?Open the ComfyUI Manager, search for “ControlNet Aux,” choose the latest version, install it, and then restart ComfyUI so the new nodes become available.
What nodes are commonly used in a ControlNet setup?Common nodes include Load Checkpoint, CLIP Text Encode for positive and negative prompts, Load VAE, Load ControlNet Model, Load Image, Apply ControlNet, a preprocessor node when needed, and Preview Image to inspect preprocessing results.
What is the QR Code ControlNet used for?The QR Code ControlNet can embed a hidden image inside a generated picture, often in a subtle way. It does not require preprocessing, which makes it a good first ControlNet to try.
How can I make the hidden image in QR Code ControlNet more visible?You can increase the ControlNet strength. A higher strength makes the hidden image easier to see, although it may reduce subtlety and natural blending.
How does the Scribble ControlNet help with stylizing real images?The Scribble ControlNet converts an image into outline-like reference data, which lets the model keep the structure of the original image while transforming it into a new style, such as anime.
What is the OpenPose ControlNet good for?OpenPose is used to control a subject’s pose very precisely. It is especially useful when you want a character to match a specific body position, hand placement, or overall stance.
What does Semantic Segmentation control in an image generation workflow?Semantic Segmentation captures the general composition of a scene by labeling areas like trees, sidewalks, and background regions. This lets the model preserve the arrangement of objects while still being creative with the final look.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Local Image Generation ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Local Image Generation ebook for free