MCPcopy Index your code
hub / github.com/ant-research/MagicQuill

github.com/ant-research/MagicQuill @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
1,786 symbols 4,121 edges 78 files 194 documented · 11% 8 cross-repo links updated 7mo ago★ 3,68344 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

🪶 MagicQuill: An Intelligent Interactive Image Editing System (CVPR 2025)

https://github.com/user-attachments/assets/8ee9663a-fef2-484a-a0b7-8427ab590424

There is an HD video on Youtube.

Zichen Liu*,1,2, Yue Yu*,1,2, Hao Ouyang2, Qiuyu Wang2, Ka Leong Cheng1,2, Wen Wang3,2, Zhiheng Liu4, Qifeng Chen†,1, Yujun Shen†,2

1HKUST 2Ant Group 3ZJU 4HKU *equal contribution corresponding author

TLDR: MagicQuill is an intelligent and interactive system achieving precise image editing.

Key Features: 😎 User-friendly interface / 🤖 AI-powered suggestions / 🎨 Precise local editing

MagicQuillV2 has been released!!! Check it out ;)

TODO List

  • [x] Release the paper and demo page. Visit magicquill.art 🪩
  • [x] Release the code and checkpoints.
  • [x] Release gradio demo.
  • [x] Release ComfyUI MagicQuill custom node.

Update Log

  • [2024.11.21] 📢 Update the save button; Fix path bug on Windows; Add .bat and .sh files for convenient environment install on Windows and Linux. Thanks lior007 and JamesIV4.
  • [2024.11.25] 📢 New UI Updates: Drag & Drop Images + Download Button: We've enhanced our interface with two exciting features! Now you can easily upload images with drag & drop functionality, and quickly save your work using our new download button. Try it out and let us know what you think!
  • [2024.12.06] 📢 New Feature Updates: Auto-save and Resolution Adjustment are now enabled in the parameter settings. Thanks Furkan Gözükara for his brilliant suggestions.
  • [2024.12.07] 🎉 Exciting News: ComfyUI MagicQuill Node has been released! Check the repository https://github.com/magic-quill/ComfyUI_MagicQuill for more details.
  • [2024.12.16] 🎉 Exciting News: MagicQuill is also available at Modelscope. Thanks for their amazing support and infrastructure.
  • [2025.01.02] 🎉 Exciting News: MagicQuill docker container is now available. You can now build & run your own image in a cleaner, isolated environment. Thanks gbudge for his contribution.
  • [2025.02.27] 🎉 Exciting News: MagicQuill has been accepted to CVPR 2025! Looking forward to meeting everyone in Tennessee!
  • [2025.12.03] 🎉 Exciting News: MagicQuillV2 has been released! Check it out ;), give us a star if you are interested.

To update the latest features, pull the latest code and re-install the gradio_magicquill:

pip uninstall -y gradio_magicquill-0.0.1-py3-none-any.whl
pip install gradio_magicquill-0.0.1-py3-none-any.whl

Hardware Requirements

  • GPU is required to run MagicQuill. Through our testing, we have confirmed that the model can run on GPUs with 8GB VRAM (RTX4070 Laptop).

For users with limited GPU resources, please try our Huggingface Demo and Modelscope Demo. Also, consider disabling the DrawNGuess automatic prompt filling by clicking the wand icon above if it takes too long time on your machine.

Setup

Follow the following guide to set up the environment.

  1. git clone repo. Please don't forget the --recursive flag. Otherwise, you will find LLaVA submodule missing. git clone --recursive https://github.com/magic-quill/MagicQuill.git cd MagicQuill
  2. download and unzip checkpoints wget -O models.zip "https://hkustconnect-my.sharepoint.com/:u:/g/personal/zliucz_connect_ust_hk/EWlGF0WfawJIrJ1Hn85_-3gB0MtwImAnYeWXuleVQcukMg?e=Gcjugg&download=1" unzip models.zip If the .zip file is not accessible, download it via browser. All checkpoints are about 25 GB in total. It may take some time to download. Alternatively, check our checkpoints at huggingface.

If you are a Windows user, you may try to use windows_setup.bat to conveniently install environments, just enter windows_setup.bat in your Python shell. For Linux user, check linux_setup.sh.

Alternatively, follow the step-by-step installation guide.

  1. create environment conda create -n MagicQuill python=3.10 -y conda activate MagicQuill

  2. install torch with GPU support pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu118

  3. install the interface pip install gradio_magicquill-0.0.1-py3-none-any.whl

  4. install llava environment (For Linux) cp -f pyproject.toml MagicQuill/LLaVA/ pip install -e MagicQuill/LLaVA/ or (For Windows) copy /Y pyproject.toml MagicQuill\LLaVA\ pip install -e MagicQuill\LLaVA\ (For Windows PowerShell, the first line should be Copy-Item -Path pyproject.toml -Destination "MagicQuill\LLaVA" -Force)

  5. install the remaining environment pip install -r requirements.txt

  6. run magicquill python gradio_run.py If you are mainland user, you may try export HF_ENDPOINT=https://hf-mirror.com to use huggingface mirror to facilitate the download of some necessary checkpoints to run our system.

Docker Container

You can build a docker container with MagicQuill as follows:

  1. git clone repo. Please don't forget the --recursive flag. Otherwise, you will find LLaVA submodule missing. git clone --recursive https://github.com/magic-quill/MagicQuill.git cd MagicQuill

  2. download and unzip checkpoints wget -O models.zip "https://hkustconnect-my.sharepoint.com/:u:/g/personal/zliucz_connect_ust_hk/EWlGF0WfawJIrJ1Hn85_-3gB0MtwImAnYeWXuleVQcukMg?e=Gcjugg&download=1" unzip models.zip If the .zip file is not accessible, download it via browser. All checkpoints are about 25 GB in total. It may take some time to download. Alternatively, check our checkpoints at huggingface.

    Note: these can be located anywhere on the host computer, but Docker Compose expects them to be in /data/magicquill/models by default. Update docker-compose.yaml if you unzip them to another location.

  3. build the image docker compose build

  4. run the image docker compose up -d

Tutorial

Please read before you try!

I. Three type of magic quills

SVG image Use the add brush to add details and elements guided by prompts - express your ideas with your own lively strokes! gif description "With just a few strokes, a vivid little deer comes to life" gif description "Adorn the beautiful lady with a necklace" SVG image The subtract brush can remove excess details or redraw areas based on prompts. If there's anything you're not satisfied with, just subtract it away! gif description "A dolphin with two tail fins? Let's give it a quick 'treatment'!" gif description "Let's take off Mr. Skeleton's hat and help him cool down." add brush&minus brush Combine the add and subtract brushes to create amazing combo effects! gif description "Let's give Mona Lisa a pet cat~" gif description "Let's give this handsome fellow a new tie!" SVG image The color brush can precisely color the image, matching the color of your brush~ gif description "Precise color highlighting - paint exactly where you want to color" gif description "Don't you think the blue flowers look more dreamy than the pink ones?" *Please note the color brush and add&subtract brush are mutually exclusive - you can only use one at a time!

II. Draw and Guess

SVG image Our brush is super smart! Look at the examples above - as soon as you finish drawing, it quickly guesses what you want to create and fills in the prompts for you~ Sometimes it might guess wrong though, so feel free to tell it what you actually want to draw~ gif description "Oops! I don't want to draw a vine, I want to create a path!"

III. Super useful canvas tools!

SVG image Click this button to upload the photo you want to edit~ SVG image Made a mistake with the brush? Just erase it with the rubber tool! SVG image Drag, rotate, and resize your strokes with the cursor - just like when you're working in PowerPoint! add brush&minus brush Left is ctrl+z, right is ctrl+y - you know what that means! 😊 And for Mac users, left is command+z, r

Core symbols most depended-on inside this repo

to
called by 286
MagicQuill/comfyui_utils.py
copy
called by 34
MagicQuill/comfy/controlnet.py
load_state_dict
called by 32
MagicQuill/comfy/k_diffusion/utils.py
sigma
called by 30
MagicQuill/comfy/k_diffusion/sampling.py
clone
called by 28
MagicQuill/comfy/sd.py
state_dict
called by 23
MagicQuill/comfy/k_diffusion/utils.py
conv_nd
called by 19
MagicQuill/comfy/ops.py
callback
called by 18
MagicQuill/latent_preview.py

Shape

Method 1,005
Function 397
Class 382
Route 2

Languages

Python100%

Modules by API surface

MagicQuill/brushnet/unet_2d_blocks.py117 symbols
MagicQuill/comfy/ldm/modules/diffusionmodules/mmdit.py64 symbols
MagicQuill/comfy/model_management.py63 symbols
MagicQuill/comfy/model_base.py63 symbols
MagicQuill/comfy/supported_models.py56 symbols
MagicQuill/comfy/model_sampling.py52 symbols
MagicQuill/comfy/k_diffusion/sampling.py52 symbols
MagicQuill/comfy/samplers.py50 symbols
MagicQuill/comfy/ops.py45 symbols
MagicQuill/comfyui_utils.py41 symbols
MagicQuill/comfy/controlnet.py41 symbols
MagicQuill/comfy/sd.py40 symbols

Dependencies from manifests, versioned

accelerate0.33.0 · 1×
diffusers0.31.0 · 1×
opencv-python4.10.0.84 · 1×
peft0.13.2 · 1×
protobuf4.25.4 · 1×
sentencepiece0.2.0 · 1×
tokenizers0.15.1 · 1×
torch2.1.2 · 1×
torchsde0.2.6 · 1×

For agents

$ claude mcp add MagicQuill \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact