ComfyUI: Background replacement with Inpaint Crop

Demo summary
The user demonstrates a workflow using background removal and the Inpaint Crop node to swap a product's background while attempting to maintain the original item's integrity.
Step-by-step
- Add a product image with a clear subject to the workflow
- Use a background removal node to isolate the product
- Convert the resulting mask to an image
- Connect the image and mask to the Inpaint Crop node
- Enter a prompt for the new background (e.g., 'yellow studio background')
- Adjust the 'blending pixels' value to manage the transition between the product and the new background
- Run the generation to stitch the original product onto the new AI-generated background
Options
- Set blending pixels to zero for a sharper edge if you have a perfectly clean mask
- Try different background colors in the prompt to match the original lighting
Watch out for
- Don't use images that are too big as the node inpaints the entire background
- Products photographed on white backgrounds will show poor blending when prompted for dark backgrounds due to light reflections
- A visible contour may appear around the product depending on mask quality and blending settings
Tips
- Use a product image where the subject is clear to improve background removal
- Match the new background prompt to the original photo's lighting (e.g., use 'snow' for a product shot on white) for a more believable result
- Play with the blending pixels value to hide imperfections on the mask edges
- Keep image sizes moderate to optimize the inpainting process
Highlights
“it looks pretty believable, but you should play with the settings and the mass depending on your product”
All demos from “ComfyUI Tutorial Series Ep 52: Master Flux Kontext – Inpainting, Editing & Character Consistency”
2:432:38Generate and upscale images with Flux KontextThe creator demonstrates setting up a basic Flux Kontext workflow in ComfyUI, generating a character image, and then using a KSampler-based upscaler to increase resolution.ComfyUI· AI Image Upscaler
7:201:48Edit image details with Flux KontextThe user shows how to load a reference image and use a text prompt to change specific features, such as changing a cartoon bunny's eye color to red.ComfyUI· AI Inpainting
11:131:26Combine two images using Image StitchThe tutorial demonstrates using the Image Stitch node to combine two separate reference images (a woman and a bunny) into a single scene using Flux Kontext.ComfyUI· AI Image Combiner
12:481:45Style transformation and line art conversionThe creator demonstrates transforming a portrait into a watercolor painting and converting a 3D-style bunny into a line art illustration using specific style prompts.ComfyUI· AI Style Transfer
15:471:17Product branding and placementThe video shows how to take a logo or a product photo (perfume bottle) and use Flux Kontext to place it into a new, AI-generated environment with realistic reflections.ComfyUI· AI Product Photography
17:062:04Background replacement with Inpaint CropCurrentThe user demonstrates a workflow using background removal and the Inpaint Crop node to swap a product's background while attempting to maintain the original item's integrity.ComfyUI· AI Background Generator
19:191:08Modify hairstyles and facial featuresThe creator shows how to change a subject's hair color and style (e.g., to a blunt bob with bangs) while attempting to maintain facial consistency using Flux Kontext.ComfyUI· AI Inpainting
21:030:26Edit text within an imageA demonstration of Flux Kontext's ability to change text on a 3D render from 'Welcome' to 'Pixaroma' while maintaining the original font style and perspective.ComfyUI· AI Inpainting
23:191:55Remove objects using Mask Editor and InpaintingThe user demonstrates precisely removing a necklace from a portrait by painting a mask in the ComfyUI Mask Editor and using an inpainting prompt.ComfyUI· AI Inpainting
25:461:20Apply LoRA models to Flux KontextThe creator shows how to use the Power Lora Loader to apply a 'Glass Prism' LoRA to a product image to transform its visual style.ComfyUI· AI Style Transfer- Watch “ComfyUI Tutorial Series Ep 52: Master Flux Kontext – Inpainting, Editing & Character Consistency” →
AI Background Generator
17:062:04Background replacement with Inpaint CropCurrentThe user demonstrates a workflow using background removal and the Inpaint Crop node to swap a product's background while attempting to maintain the original item's integrity.pixaroma
8:470:24AI background replacementThe creator shows how to swap the environment behind a subject while keeping the person and pose consistent using a background reference image.Yaroflasher
ComfyUI