ComfyUI

Extending ComfyUI with Python

Learn how to automate your workflows with Python

Shawn @ Prompting Pixels

Extending ComfyUI with Python

ComfyUI’s power can be greatly enhanced when combined with Python. Here’s how to set it up:

  1. Install the ComfyUI tooling nodes custom node.
  2. Enable dev mode in ComfyUI settings.
  3. Set Node ID badge mode to “show all” in Light Graph settings.

Workflow Notes:

The workflow itself doesn’t really matter. All that does is the “Load Image (Base64)” (if performing an image-to-image task) and the “Send Image (WebSocket)” as an output node.

Make sure to notate the Node ID if using the Load Image (Base64) node and also export the workflow as an API file.

Python Integration:

  1. Create a directory with your input image, main.py file, and workflow file.
  2. Main.py will load the workflow, encode the input image to Base64, and send/receive the data to the ComfyUI server.
  3. Be sure to update the server IP address and Load Image node ID in the Python script.

This setup allows for batch processing, automation, and integration with other Python tools, greatly expanding ComfyUI’s capabilities.

Explore More

More ComfyUI Tutorials

Continue learning with more tutorials from the ComfyUI category.

View All ComfyUI Tutorials
Video Tutorial

Watch the full walkthrough

Extending ComfyUI with Python