From Pixels to Perfection: Mastering AI-Generated Clothing Replacement

CN
ComfyUI.org
2025-06-04 09:05:11

1. Workflow Overview

mbhq1jt8lp34ftjx5zka71211fb9f6e0b932dc768a5d6a95a205ebfd8278f806d4dd53572ac4a6c07be.gif

This is an AI-powered clothing replacement workflow featuring:

  • Automatic garment segmentation with BiRefNet

  • Context-aware inpainting using Flux Fill model

  • High-resolution output (default 1024x1536)

Key Models:

  • BiRefNet: Human parsing model (auto-downloaded)

  • Flux Fill fp8: Quantized model for clothing redraw

  • ControlNet LoRA: Style control (F.1_Fashion_Model_Sportswear_1.0)


2. Critical Nodes

Node

Function

Installation

easy humanSegmentation

Garment masking with BiRefNet

Install comfyui-easy-use

InpaintCrop

Smart cropping with context preservation

git clone https://github.com/space-nuko/ComfyUI-Inpaint-CropAndStitch

ReduxAdvanced

Advanced inpainting with CLIP vision guidance

Requires AdvancedRefluxControl

Dependencies:

  1. Model Files:

    • Flux Fill dev - fp8_黑森林官方重绘模型_fp8_e4m3fn → Save to models/flux/

    • flux1-redux-dev.style → Save to models/style_models/


3. Workflow Structure

Phase 1: Input Processing

  • Loads source image (yellow-dress.jpg)

  • Generates garment mask (expanded by 50px via GrowMask)

Phase 2: Local Redraw

  • Crops garment area (forced size 1024x1024)

  • Applies LoRA for style control (weight=0.8)

  • Prompt: "A hyper-realistic photograph, a young lady in a vibrant yellow short-sleeved dress..."

Phase 3: Composition

  • Seamless blending with ImageCompositeMasked

  • Post-processed with bislerp stitching


4. Inputs & Outputs

Required Inputs:

  • Source person image (transparent background supported)

  • Optional clothing reference (magazine.png)

Outputs:

  1. Redrawn clothing only (ComfyUI/temp_...png)

  2. Final composited image (ComfyUI/output_...jpg)


5. Important Notes

⚠️ Hardware:

  • Minimum 8GB VRAM (FP8 model reduces usage)

  • Launch with --xformers for acceleration

🔧 Troubleshooting:

  1. Rough garment edges:

    • Adjust GrowMask expansion value (default=50)

    • Change InpaintCrop resize mode to bicubic

  2. Style mismatch:

    • Switch LoRA model (multiple fashion LoRAs pre-loaded)