ComfyUI  >  Workflows  >  Insert Anything | Reference-Based Image Editing

Insert Anything | Reference-Based Image Editing

Insert Anything brings powerful reference-based image editing to ComfyUI, allowing you to seamlessly integrate elements from reference images into target scenes. Unlike other solutions that focus on specific tasks or require complex setup, this unified workflow supports both mask-guided and text-guided editing through an intuitive in-context approach. Create stunning face swaps, virtual try-ons, artistic compositions, and more - all while maintaining perfect visual harmony between the inserted elements and their surroundings. The Nunchaku version is optimized for lower VRAM usage (as low as 10GB), making advanced image editing accessible on more hardware configurations.

ComfyUI Insert Anything Workflow

Insert Anything in ComfyUI | Reference-Based Seamless Image Editing
Want to run this workflow?
  • Fully operational workflows
  • No missing nodes or models
  • No manual setups required
  • Features stunning visuals

ComfyUI Insert Anything Examples

insert-anything-in-comfyui-reference-based-seamless-image-editing-1226-example_01.webp
insert-anything-in-comfyui-reference-based-seamless-image-editing-1226-example_02.webp
insert-anything-in-comfyui-reference-based-seamless-image-editing-1226-example_03.webp
insert-anything-in-comfyui-reference-based-seamless-image-editing-1226-example_04.webp
insert-anything-in-comfyui-reference-based-seamless-image-editing-1226-example_05.webp

ComfyUI Insert Anything Description

1. What is ComfyUI Insert Anything?

ComfyUI Insert Anything brings ByteDance's powerful Insert Anything technology to the ComfyUI environment. Built on the Diffusion Transformer (DiT) architecture, this Insert Anything tool enables you to seamlessly transfer elements from reference images to target scenes while maintaining visual harmony and preserving fine details.

The Insert Anything workflow stands out from traditional image editing tools by allowing natural integration of objects, people, garments, and faces between different images with remarkable identity preservation that makes Insert Anything a versatile solution.

2. Key Benefits of Insert Anything

  • All-in-One Solution: handles multiple tasks (inserting people, objects, clothing, faces) through a single unified model
  • Dual Control Methods: works with either mask-guided selections or text-guided descriptions based on your needs
  • Detail Preservation: maintains the distinctive features and identity elements from your reference images
  • Seamless Integration: achieves natural-looking results where inserted elements blend harmoniously with their surroundings
  • Quality Output: generates high-resolution, coherent results across diverse editing scenarios
  • ComfyUI Compatible: integrates smoothly with your existing ComfyUI workflows and projects

3. How to Use Insert Anything

3.1 Basic Insert Anything Workflow Setup

Step-by-Step Insert Anything Process:

  1. Prepare your images for Insert Anything:
    • In the Source section: Upload the target image you want Insert Anything to modify (e.g., a racetrack scene)
    • In the Reference section: Upload an image containing the element you want Insert Anything to insert (e.g., a race car)
    • The Insert Anything system will automatically generate masks using Segment Anything Model (SAM)
  2. Set your prompts in the CR Prompt Text node for Insert Anything:
    • First prompt: Describe what's in your reference image (e.g., "race car")
    • Second prompt: Specify details about the Insert Anything insertion (e.g., "Race Car yellow and red")
  3. Optional Insert Anything adjustments:
    • Fine-tune masking with Src_mask_option and Ref_mask_option if needed
    • Adjust threshold parameters for more precise object detection in Insert Anything
  4. Click the Run button to process your images with Insert Anything
Insert Anything Insert Anything

3.2 What You Can Create with Insert Anything

  • Product Showcase: Use Insert Anything to insert products into hand-held poses or contextual scenes
  • Virtual Try-On: Let Insert Anything replace clothing items while maintaining natural fit and draping
  • Identity Transfer: Apply Insert Anything to swap facial features while preserving natural expressions
  • Scene Composition: Utilize Insert Anything to replace large objects (like vehicles) in complex environments

3.3 Understanding Insert Anything Parameters

Core Insert Anything Components:

Insert Anything Preprocessing:

  • Manages Insert Anything image preparation and automatic masking
    • source_image: Your target image requiring Insert Anything modification
    • ref_image: Your reference image with the element for Insert Anything to insert
    • source_mask/ref_mask: Auto-generated or user-provided masks for Insert Anything
    • iterations: Controls Insert Anything mask expansion for better coverage (default: 2)

Insert Anything Inference:

  • Executes the actual Insert Anything insertion process
    • seed: Allows reproducible Insert Anything results or variations by changing this value

Segmentation Tools for Insert Anything:

SAM Integration with Insert Anything:

  • LayerMask: Load SegmentAnything Models: Initializes the object detection system for Insert Anything
  • LayerMask: SegmentAnythingUltra V3: Controls the Insert Anything masking process
    • threshold: Adjusts mask detection sensitivity for Insert Anything (default: 0.30)
    • detail_erode/detail_dilate: Fine-tunes mask boundaries in Insert Anything
    • process_detail: Toggles enhanced processing for complex edges in Insert Anything
    • max_megapixels: Manages memory usage for large Insert Anything images

Insert Anything Mask Controls:

  • Src_mask_option/Ref_mask_option: Select between automatic (sketch) or manual (upload) masking for Insert Anything
  • Default settings work well in most cases with Insert Anything's automatic detection

3.4 Tips for Perfect Insert Anything Results

Insert Anything Masking Refinement:

  • Adjust the threshold value (default: 0.30) for more precise Insert Anything automatic masking
  • Increase the iterations parameter when you need Insert Anything to expand mask coverage
  • For complex scenarios, try uploading custom masks through the Insert Anything option nodes

Insert Anything Workflow Optimization:

  • Experiment with different seed values to get variations from Insert Anything
  • Provide high-quality, well-lit images for the best Insert Anything results
  • Match image proportions when possible for more natural Insert Anything integration

Effective Insert Anything Prompting:

  • Keep Insert Anything prompts clear and specific about what you're inserting
  • For vehicles, include color and type information in your Insert Anything prompts
  • When using Insert Anything for face swapping, simple terms like "person" often work best
  • For clothing insertion, describe the garment type and color in your Insert Anything prompt

Acknowledgements

This workflow implements Insert Anything, originally developed by ByteDance as described in their research paper "". The ComfyUI Insert Anything integration provides a user-friendly interface for this technology. Full credit goes to the original authors for their innovative Insert Anything work.

Want More ComfyUI Workflows?

RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.