### Start ComfyUI Application Source: https://docs.comfy.org/installation/manual_install Navigates into the ComfyUI directory and starts the application by running the main Python script. ```bash cd ComfyUI python main.py ``` -------------------------------- ### Run ComfyUI Source: https://docs.comfy.org/comfy-cli/getting-started Command to launch the ComfyUI application after successful installation. ```bash comfy launch ``` -------------------------------- ### ComfyUI Inpainting Workflow Example Source: https://context7_llms This guide introduces the inpainting workflow in ComfyUI, provides a practical example, and discusses topics such as using the mask editor for targeted image manipulation. ```text This guide will introduce you to the inpainting workflow in ComfyUI, walk you through an inpainting example, and cover topics like using the mask editor ``` -------------------------------- ### HiDream-I1 Text-to-Image Workflow Example Source: https://context7_llms Walks through completing a ComfyUI native HiDream-I1 text-to-image workflow example. This guide is tailored for the I1 version of the HiDream model. ```json { "nodes": [ { "id": 1, "type": "HiDreamI1", "params": { "prompt": "a fantasy landscape with a castle and a river", "negative_prompt": "modern buildings, cars", "seed": 10112, "steps": 25, "cfg": 7.5 } }, { "id": 2, "type": "SaveImage", "params": { "filename_prefix": "hidream_i1_t2i" } } ], "links": [ [1, "IMAGE", 2, "IMAGE"] ] } ``` -------------------------------- ### Default ComfyUI Config Example Source: https://docs.comfy.org/development/core-concepts/models This is a commented-out example for configuring ComfyUI's model paths. It shows the structure for setting a `base_path` which can be a ComfyUI installation or a central model storage folder. ```yaml #config for comfyui #your base path should be either an existing comfy install or a central folder where you store all of your models, loras, etc. #comfyui: # base_path: path/to/comfyui/ ``` -------------------------------- ### Locate and Copy Example Config File Source: https://docs.comfy.org/development/core-concepts/models For portable or manual ComfyUI installations, find the `extra_model_paths.yaml.example` file in the ComfyUI root directory. Copy and rename it to `extra_model_paths.yaml` to use it. This file serves as a template for defining custom model paths. ```text ComfyUI/extra_model_paths.yaml.example ``` -------------------------------- ### ComfyUI Outpainting Workflow Example Source: https://context7_llms This tutorial introduces the outpainting workflow in ComfyUI and provides a practical example. It guides users on extending image boundaries and generating content beyond the original image dimensions. ```text This guide will introduce you to the outpainting workflow in ComfyUI and walk you through an outpainting example ``` -------------------------------- ### Install ComfyUI Source: https://docs.comfy.org/comfy-cli/getting-started Command to install ComfyUI after setting up the virtual environment. Note that GPU drivers (CUDA or ROCm) must be installed separately. ```bash comfy install ``` -------------------------------- ### Install Custom Nodes for ComfyUI Source: https://docs.comfy.org/comfy-cli/getting-started Instructions for installing custom nodes using the `cm-cli` tool, which is part of the ComfyUI Manager. Requires the node name as an argument. ```bash comfy node install ``` -------------------------------- ### ComfyUI ACE-Step Native Audio Example Source: https://context7_llms This guide assists users in creating dynamic music using the ACE-Step model in ComfyUI. It covers the workflow and parameters necessary for effective audio generation. ```text This guide will help you create dynamic music using the ACE-Step model in ComfyUI ``` -------------------------------- ### Install ComfyUI-Manager using comfy-cli (Windows) Source: https://docs.comfy.org/manager/install This method utilizes the 'comfy-cli' tool for managing ComfyUI installations, recommended for new setups. It involves creating a Python virtual environment, activating it, installing 'comfy-cli' via pip, and then running the 'comfy install' command. This is specific to Windows environments. ```bash python -m venv venv venv\Scripts\activate pip install comfy-cli comfy install ``` -------------------------------- ### Enable LAN Access for ComfyUI (Batch Script) Source: https://docs.comfy.org/installation/comfyui_portable_windows This example demonstrates how to modify a ComfyUI startup batch script (e.g., `run_nvidia_gpu.bat`) to enable LAN access. Adding the `--listen` flag allows other devices on the network to connect to the ComfyUI instance. ```batch .\python_embeded\python.exe -s ComfyUI\main.py --listen --windows-standalone-build pause ``` -------------------------------- ### Install ComfyUI-Manager using comfy-cli (Linux/macOS) Source: https://docs.comfy.org/manager/install This method uses the 'comfy-cli' tool for managing ComfyUI installations, recommended for new setups. It involves creating a Python virtual environment, activating it, installing 'comfy-cli' via pip, and then running the 'comfy install' command. This is specific to Linux and macOS environments. ```bash python -m venv venv . venv/bin/activate pip install comfy-cli comfy install ``` -------------------------------- ### Flux.1 Text-to-Image Workflow Example Source: https://context7_llms Provides a brief introduction to the Flux.1 model and guides through text-to-image generation. Examples include using the full version and the FP8 Checkpoint version for generating images from text prompts. ```json { "nodes": [ { "id": 1, "type": "Flux1TextToImage", "params": { "prompt": "a futuristic cityscape at sunset", "negative_prompt": "blurry, low quality", "seed": 12345, "steps": 30, "cfg": 8.0, "model_version": "full" } }, { "id": 2, "type": "SaveImage", "params": { "filename_prefix": "flux1_text_to_image" } } ], "links": [ [1, "IMAGE", 2, "IMAGE"] ] } ``` -------------------------------- ### Install Comfy CLI using pip or Homebrew Source: https://docs.comfy.org/comfy-cli/getting-started Instructions for installing the Comfy CLI tool. Users can choose between pip for general Python environments or Homebrew for macOS users. ```bash pip install comfy-cli ``` ```bash brew tap Comfy-Org/comfy-cli brew install comfy-org/comfy-cli/comfy-cli ``` -------------------------------- ### ComfyUI Custom Node Backend Annotated Examples Source: https://context7_llms Provides annotated code examples for developing ComfyUI custom nodes. Demonstrates practical implementation patterns and best practices. ```python # Annotated example of a simple ComfyUI custom node # Import necessary ComfyUI classes from nodes import BaseNode, NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS # Define the node class, inheriting from BaseNode class SimpleAdder: # Define the category and name for the node """Adds two numbers together.""" CATEGORY = "math" NODE_NAME = "Simple Adder" # Define the input types and names @classmethod def INPUT_TYPES(cls): return { "required": { "a": ("INT", { "default": 0, "min": -9999, "max": 9999, "step": 1 }), "b": ("INT", { "default": 0, "min": -9999, "max": 9999, "step": 1 }), }, "optional": { "c": ("INT", { "default": 0, "min": -9999, "max": 9999, "step": 1 }), } } # Define the output types and names # The return value of this method is what the node outputs def output(self, a, b, c=0): result = a + b + c print(f"Result of addition: {result}") return (result,) # Register the node class in the mapping # This makes the node available in ComfyUI NODE_CLASS_MAPPINGS["SimpleAdder"] = SimpleAdder NODE_DISPLAY_NAME_MAPPINGS["SimpleAdder"] = "Simple Adder Node" ``` -------------------------------- ### Configure Stable Diffusion WebUI Model Paths Source: https://docs.comfy.org/installation/manual_install This YAML configuration example shows how to set up model paths for a Stable Diffusion WebUI installation, specifying locations for checkpoints, VAEs, LoRAs, and other model types relative to the WebUI's base path. ```yaml a111: base_path: D:\\stable-diffusion-webui\\ checkpoints: models/Stable-diffusion configs: models/Stable-diffusion vae: models/VAE loras: | models/Lora models/LyCORIS upscale_models: | models/ESRGAN models/RealESRGAN models/SwinIR embeddings: embeddings hypernetworks: models/hypernetworks controlnet: models/ControlNet ``` -------------------------------- ### Install Dependencies with Mirror Source: https://docs.comfy.org/installation/update_comfyui If network issues prevent direct access to PyPI, especially in regions like mainland China, using a mirror like Tsinghua University's can resolve the problem. This command installs dependencies using the specified mirror. ```bash pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple ``` -------------------------------- ### Set up ComfyUI Virtual Environment Source: https://docs.comfy.org/comfy-cli/getting-started Guides users on creating and activating a virtual environment for ComfyUI using either Conda or venv. Requires Python version greater than 3.9. ```bash conda create -n comfy-env python=3.11 conda activate comfy-env ``` ```bash python3 -m venv comfy-env source comfy-env/bin/activate ``` -------------------------------- ### Default ComfyUI Model Path Configuration Example Source: https://docs.comfy.org/installation/desktop/windows This YAML code shows the default structure for configuring ComfyUI's model paths. It includes a commented-out example for setting a `base_path` and various model directories. Users can uncomment and modify this section to suit their setup. ```yaml #config for comfyui #your base path should be either an existing comfy install or a central folder where you store all of your models, loras, etc. #comfyui: # base_path: path/to/comfyui/ ``` -------------------------------- ### ComfyUI Basic ControlNet Usage Example Source: https://context7_llms This guide introduces the fundamental concepts of ControlNet and demonstrates how to generate corresponding images in ComfyUI. It covers using ControlNet for guided image creation. ```text This guide will introduce you to the basic concepts of ControlNet and demonstrate how to generate corresponding images in ComfyUI ``` -------------------------------- ### Flux.1 Fill Dev Inpainting/Outpainting Workflow Example Source: https://context7_llms Demonstrates how to use Flux.1 fill dev for creating Inpainting and Outpainting workflows. This guide covers the setup and usage of the fill dev functionality for image editing tasks. ```json { "nodes": [ { "id": 1, "type": "LoadImage", "params": { "image": "path/to/your/image.png" } }, { "id": 2, "type": "LoadMask", "params": { "mask": "path/to/your/mask.png" } }, { "id": 3, "type": "Flux1FillDev", "params": { "prompt": "a dog in the park", "negative_prompt": "", "seed": 12345, "steps": 20, "cfg": 7.0 } }, { "id": 4, "type": "SaveImage", "params": { "filename_prefix": "flux1_fill_dev" } } ], "links": [ [1, "IMAGE", 3, "IMAGE"], [2, "MASK", 3, "MASK"], [3, "IMAGE", 4, "IMAGE"] ] } ``` -------------------------------- ### ComfyUI Image to Image Workflow Example Source: https://context7_llms This tutorial explains and guides users through completing an image-to-image workflow in ComfyUI. It covers the process of transforming an input image based on specified parameters. ```text This guide will help you understand and complete an image to image workflow ``` -------------------------------- ### Install ComfyUI-Manager Dependencies (Manual Install) Source: https://docs.comfy.org/manager/install Installs the required dependencies for ComfyUI-Manager for manual ComfyUI installations after activating the virtual environment. It reads dependencies from the 'manager_requirements.txt' file. ```bash pip install -r manager_requirements.txt ``` -------------------------------- ### Activate Virtual Environment (Manual Install) Source: https://docs.comfy.org/manager/install Activates the Python virtual environment for manual ComfyUI installations on both Windows and Linux/macOS systems. This is a prerequisite for installing manager dependencies. ```bash # Windows venv\Scripts\activate ``` ```bash # Linux/macOS source venv/bin/activate ``` -------------------------------- ### ComfyUI Account API Key Integration Example Source: https://context7_llms Demonstrates how to use ComfyUI Account API Key to call paid API nodes in headless mode. This is crucial for automating tasks and integrating ComfyUI into CI/CD pipelines or other automated systems. ```python import requests api_key = "YOUR_COMFYUI_API_KEY" server_url = "http://127.0.0.1:8188" headers = { "X-ComfyUI-Api-Key": api_key } # Example: Sending a prompt to a text-to-image node payload = { "prompt": { "prompt_text": "A futuristic cityscape at sunset", "negative_prompt": "blurry, low quality" } } response = requests.post(f"{server_url}/api/v1/execute/text2img", headers=headers, json=payload) print(response.json()) ``` -------------------------------- ### Install ComfyUI Dependencies Source: https://docs.comfy.org/installation/manual_install Navigates into the ComfyUI directory and installs all required Python dependencies listed in the 'requirements.txt' file using pip. ```bash cd ComfyUI pip install -r requirements.txt ```