English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

ComfyUI Complete Tutorial: From Beginner to Master (Node-Based AI Image Generation Guide)

Forum topic · 小凯 · 2026-03-18

Summary

A comprehensive Chinese-language tutorial on zhichai.net explains ComfyUI, the node-based interface for Stable Diffusion image generation, using the metaphor of building blocks. The guide covers three installation methods (official Desktop app, Windows portable build, and manual Python/PyTorch setup), explains the node system with color-coded data types (MODEL, CLIP, VAE, CONDITIONING, LATENT, IMAGE, MASK), and walks through the classic text-to-image workflow: Load Checkpoint, CLIP Text Encode, Empty Latent Image, KSampler, VAE Decode, and Save Image. It details key KSampler parameters such as seed, steps, and CFG, then progresses to image-to-image generation, inpainting with Set Latent Noise Mask, ControlNet (OpenPose, Canny, Depth, MLSD) for controlling pose and composition, and LoRA fine-tuning for styles and characters. Advanced chapters cover hi-res fix workflows, area composition, upscaling methods, custom nodes with ComfyUI-Manager, and practical case studies including character consistency, product rendering, architectural style transfer, and animation with AnimateDiff. Appendices list keyboard shortcuts, common error troubleshooting (CUDA out-of-memory, missing nodes), and recommended resources like Civitai, Hugging Face, and official ComfyUI examples.

This long-form Chinese tutorial introduces ComfyUI, the node-based visual workflow tool for Stable Diffusion image generation. Below is a structured English summary preserving the original's technical content.

Core Philosophy

ComfyUI makes AI image generation transparent and modular: instead of a black-box interface, every step (loading models, encoding prompts, sampling, decoding) is a draggable node connected into a visible data flow, letting you pinpoint exactly where problems occur.

Key points

1. Installation (three options)

  • Desktop app: official one-click installer for Windows/macOS, auto-updates, built-in model manager
  • Portable build (Windows): download from https://github.com/comfyanonymous/ComfyUI/releases, unzip and run; models go under ComfyUI/models/ (checkpoints, loras, controlnet, vae, upscale_models)
  • Manual install: git clone the repo, pip install -r requirements.txt, install PyTorch for your hardware (CUDA / ROCm / Apple Silicon), launch with python main.py; UI runs at http://127.0.0.1:8188
  • 2. Node fundamentals

  • Nodes have inputs (left), parameters (middle), outputs (right)
  • Color-coded data types: MODEL (purple), CLIP (yellow), VAE (rose), CONDITIONING (orange), LATENT (pink), IMAGE (blue), MASK (green)
  • Latent space is a compressed representation AI works in; VAE decodes it back to pixels
  • 3. Text-to-image workflow

    Load Checkpoint → CLIP Text Encode (positive/negative prompts) → Empty Latent Image → KSampler → VAE Decode → Save Image

    Key KSampler parameters:

  • seed: same seed + parameters = same image
  • steps: denoising iterations; 20–30 is typical
  • cfg: prompt adherence; 7–8 is common, too high causes oversaturation
  • sampler/scheduler: Euler, DPM++, UniPC, etc.
  • Base resolution 512×512 for SD1.5, 1024×1024 for SDXL; larger sizes need more VRAM
  • 4. Img2img and inpainting

  • Img2img replaces Empty Latent with a real image; the denoise parameter controls change: 0.2–0.4 for style transfer, 0.5–0.7 for major changes, 0.8–1.0 for near-total repaint
  • Inpainting uses Set Latent Noise Mask; right-click a loaded image → Open in MaskEditor to paint the region to regenerate
  • 5. ControlNet

    Pipeline: Load Image → Preprocessor → Load ControlNet Model → Apply ControlNet → KSampler

    | Preprocessor | Use case | |---|---| | Canny | edge/structure preservation | | OpenPose | human pose control | | Depth | spatial layering | | MLSD | straight lines (architecture) | | Scribble | sketch-to-image | | Segmentation | region control |

    Multiple ControlNets can be stacked (e.g., OpenPose + Depth + Canny).

    6. LoRA

    LoRA (Low-Rank Adaptation) files are small fine-tuning add-ons (tens of MB) applied between Checkpoint and CLIP encoding via the Load LoRA node. The strength_model parameter scales effect (1.0 = full; negative values invert). Multiple LoRAs can be chained; lower strength if characters degrade.

    7. Advanced techniques

  • Hi-Res Fix: generate at 512×512, upscale latent, re-sample with denoise ~0.5 for detail
  • Area composition: Conditioning (Set Area) nodes assign prompts to specific regions
  • Upscaling: latent upscale, AI models (ESRGAN, SwinIR via Load Upscale Model), or Ultimate SD Upscale for 4K/8K tiled output
  • 8. Custom nodes and ComfyUI-Manager

    Install Manager into custom_nodes (https://github.com/ltdrdata/ComfyUI-Manager.git). Its key feature: Install Missing Custom Nodes automatically detects and installs nodes required by downloaded workflows. Recommended packs: Impact-Pack (face fixing), ControlNet-Aux, Custom-Scripts, Efficiency-Nodes, WAS Node Suite.

    9. Practical case studies

  • Character consistency: character LoRA + OpenPose + IP-Adapter
  • Product rendering: Canny + Depth + inpainting
  • Architecture: MLSD + style LoRAs
  • Animation: AnimateDiff + OpenPose + IP-Adapter
  • Quick troubleshooting

    | Error | Fix | |---|---| | CUDA Out of Memory | smaller image, lower batch, --lowvram | | Model not found | check folder placement | | Node not found | install via Manager | | Connection type mismatch | verify wire colors match | | Invalid latent | latent dimensions must be multiples of 8 |

    Useful shortcuts

    Ctrl+Enter run, Ctrl+Z/Y undo/redo, Ctrl+M mute node, Ctrl+B bypass node, double-click to search nodes, Space+drag pan canvas.

    Resources

  • ComfyUI GitHub
  • ComfyUI Examples
  • Official docs
  • Civitai, Hugging Face
The tutorial closes with Richard Feynman's principle — "What I cannot create, I do not understand" — framing node-based workflows as the path to truly mastering AI image generation.

Tags

#comfyui#stable-diffusion#ai-image-generation#controlnet#lora#node-based-workflow#inpainting#tutorial

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/177168890