From Basics to Pro: A Workflow for AI-Powered Image Editing and Enhancement

CN
ComfyUI.org
2025-04-21 10:51:17

1. Workflow Overview

m9qygepw097wmwpvd1wede08447d450b6c267258bee1f9c2f200beb2daccdd76330d027855e5c7e1648.gif

This workflow is designed for local image editing and enhancement, including:

  • Object Removal: Mask unwanted areas for AI-based content fill.

  • Inpainting: Precise regeneration of masked regions.

  • Face Restoration: Enhances facial details via CodeFormer.

  • Super-Resolution: Upscales images (e.g., 4x) using AI models.

Core Models:

  • Stable Diffusion (Flux): Base image generation/inpainting.

  • ControlNet (Canny): Preserves structural consistency.

  • CodeFormer: Face refinement.

  • 4xNomos8kSCHAT-L: Upscaling model.


2. Key Nodes & Installation

Node Name

Function

Installation

Dependencies

UnetLoaderGGUF

Loads Flux UNet model

Requires ComfyUI-GGUF plugin

flux1-fill-dev-fp16-Q4_0-GGUF.gguf

InpaintCrop

Crops masked areas for inpainting

Install comfyui-inpaint-cropandstitch

None

ReActorRestoreFace

Face restoration (CodeFormer)

Install comfyui-reactor-node

codeformer-v0.1.0.pth

ImageUpscaleWithModel

AI-based upscaling

Built-in

4xNomos8kSCHAT-L.pth

Special Dependencies:

  • Flux Model: Manually download GGUF model to models/unet.

  • CodeFormer: Place model in models/codeformer.


3. Workflow Groups

  1. Input & Mask Processing (Upload Image Group)

    • Input: Image with mask (PNG).

    • Key Nodes: LoadImage, GrowMask.

  2. Local Inpainting (Flux Inpainting Group)

    • Uses InpaintModelConditioning with prompts.

    • Output: Latent representation of inpainted area.

  3. Face & Upscale (Face Restoration Group)

    • ReActorRestoreFaceImageUpscaleWithModel.

  4. Comparison (Image Comparer)

    • Compares original/processed images.


4. Input/Output

  • Inputs:

    • Resolution: Default 1024x1024 (adjustable via ConstrainImage).

    • Negative Prompt: Pre-set (e.g., "low quality, watermark").

    • Mask: Must fully cover target area.

  • Output: Final image (PNG) with edits and upscaling.


5. Notes

  1. Hardware: 12GB+ VRAM recommended (upscaling is resource-heavy).

  2. Errors:

    • Incomplete masks cause artifacts.

    • Missing models: Verify paths for GGUF/CodeFormer.

  3. Optimization:

    • Reduce KSampler steps for faster runs.

    • Split workflow if VRAM is limited (inpaint → upscale separately).