Generate canny, depth, scribble and poses with ComfyUI ControlNet preprocessors

How to use the ControlNet pre-processor nodes with sample images to extract image data. Includes sample worfklow ready to download and use.

Requirements

Workflow explained

Whenever this workflow is run, the sample image will be enhanced and processed to extract the corresponding data using these nodes:

  1. Canny Edge
  2. HED soft-edge Lines
  3. Depth Anything
  4. Scribble Lines
  5. Anime Lineart
  6. Realistic Lineart
  7. DWPose Estimator

The generated images will be saved in a folder with the followig structure: output/YYYY-MM-DD/controlnet/*.png

ControlNet Preprocessors workflow explained

Controlnet Preprocessors

  1. Use the Load Image node to open the sample image that you want to process.
  2. Set the output image size as follows:
    • The Output Width should be 512 or 768 for SD1.5, 1024 or more for SDXL.
    • The Output Height should be 512 or 768 for SD1.5, 1024 or more for SDXL.
  3. Configure the Enhanced and Resize Hint Images resize_mode to Crop and Resize (recommended) or Just Resize. This method could stretch the image, overriding its original aspect ratio, depending on your chosen width and height and the source image’s size.
  4. Use the AIO Aux Preprocessor node to optionally apply any other pre-processing method you want to the source image.
  5. In the Canny Edge, HED Soft-Edge Lines, Depth Anything, Scribble Lines, Anime Lineart, Realistic Lineart and DWPose Estimator nodes, the output width will be set by the value set from your Output Width primitive node.
  6. Configure the DWPose Estimator node as follows:
    1. detect_hand: enable or disable. The sample workflow is set to disable.
    2. detecy_body: enable or disable.
    3. detect_face: enable or disable. The sample workflow is set to disable.
  7. The Save Image node uses the filename_prefix %date:yyyy-MM-dd%/%date:hhmmss%_%KSampler.seed% to save the images on a folder with current date.

ControlNet sample output images

Controlnet Preprocessors Output

How to improve source images

  • To prevent distortion, source images should have the same aspect ratio as the output image, or use the Crop and Resize resize_mode if you are happy with the preprocessor cropping the source image either vertically or horizontally.
  • To extract poses, the subject should be properly centered. If the subject is too small/far away, the detected pose will be less precise, specially for hands and face detection. If the subject is too close, the generated images could result in a cropped subject.

Feedback

If you need help with this workflow, kindly leave a comment using the Disqus Comments section below.

Disclaimer

The content in this post is for general information purposes only. The information is provided by the author and/or external sources and while we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the post for any purpose. Some of the content and images used in this post may be copyrighted by their respective owners. The use of such materials is intended to be for educational and informational purposes only, and is not intended to infringe on the copyrights of any individuals or entities. If you believe that any content or images used here violate your copyright, please contact us and we will take appropriate measures to remove or attribute the material in question.