Master the Art of Background Replacement: A Step-by-Step AI Workflow
Workflow Overview

This workflow enables background replacement for:
Objects
People
General images
It uses Stable Diffusion (AYU_阿屿_写实大模型_V1), IPAdapter, IC Light, and mask processing to accurately extract subjects and replace backgrounds.
Core Models
Stable Diffusion AYU_阿屿_写实大模型_V1
Handles image generation and style consistency.
IPAdapter (PLUS high strength)
Ensures subject integrity while replacing the background.
IC Light (iclight_sd15_fcon.safetensors)
Matches lighting between the new background and the subject.
VAE (Variational AutoEncoder)
Encodes and decodes latent images for quality output.
Key Components (Nodes)
LoadImage
Loads the input image.
easy imageRemBg
Removes the background and generates a subject mask.
GrowMask
Expands the mask for smoother transitions.
MaskToImage
Converts masks into images for background processing.
IPAdapterUnifiedLoader & IPAdapterAdvanced
Maintains subject consistency.
ICLightConditioning & ICLightApplyMaskGrey
Matches lighting between subject and background.
KSampler
Generates a new background based on a text prompt.
Image Blending Mode & Image Blend by Mask
Combines subject with new background.
VAEDecode
Converts latent space into a final high-quality image.
SaveImage
Saves the final background-replaced image.
Workflow Structure
This workflow consists of five main stages:
1. Input & Preprocessing
LoadImage loads the input.
easy imageRemBg removes the background.
2. Mask Processing
GrowMask refines edges.
MaskToImage converts the mask.
3. Background Generation
KSampler generates a new background.
4. Merging Subject & Background
Image Blending Mode & IC Light ensure smooth blending.
5. Output
VAEDecode produces the final image.
SaveImage stores the result.
Input & Output
Inputs
Original image
Text prompt (for background)
Mask refinement settings
Lighting match strength
Outputs
Background-replaced image
Ready-to-save output
Considerations
Performance
Requires RTX 3090+ for best performance.
Troubleshooting
If subject edges look unnatural, adjust GrowMask strength.
If lighting doesn’t match, tweak IC Light parameters.
Compatibility
Works with ComfyUI 0.4+; some nodes require ComfyUI-Manager.
This analysis provides a detailed guide for beginners and intermediate users to successfully use this background replacement workflow in ComfyUI! 🚀