Qwen 2511 遮罩重繪工作流:裁切局部、選用參考圖編輯後貼回原圖
Qwen 2511 Masked Repaint: Crop the Masked Block, Edit with a Reference, Paste It Back Seamlessly
AI-KSK 分享一套以 Qwen 2511 對高解像度圖片作局部重繪的 ComfyUI 工作流,先裁切遮罩區域,再按補邊資訊將結果貼回原圖。加入參考圖後,工作流亦可將參考物件轉移至遮罩區域;運行依賴第三方 Xiaozhi 節點外掛,並使用 4-step accelerator。最長邊 2048 是避免 VRAM 不足或結果變差的上限,並非縮放設定;作者指出 2048x2048 方圖效果不理想。
Editing a small region of a large image with a diffusion model normally forces you to downscale the whole picture and lose the detail you cared about. This graph takes the opposite route: paint a mask, crop that region out with padding information, repaint only the crop - with a reference image if you want object transfer - then paste the result back at full resolution.
Evidence note: parameters below were parsed from the workflow JSON shipped with this episode (2 files); anything the video reports about results is attributed to the author.
When this is useful
- You need to change one object in a high-resolution image without downscaling it.
- You want to put an object from a reference image into a masked region ("everything transfer").
- You want a reusable paste-back step rather than manual compositing.
The three-stage construction
Why the native nodes failed
When 2511 launched the author tried building masked repaint from ComfyUI's native nodes; he says the results failed completely.
This graph relies on Xiaozhi's node plugin (his name in the episode). The author swapped the models in the plugin's example workflow and confirmed it still runs stably - that is the version shipped here.
Stage 1: mask, then crop with padding info
Load an image, right-click into the mask editor, paint the region, then prompt. The graph crops a square around your mask and sends only that block onward.
The crop node carries padding info so stage 3 can put the block back exactly where it came from - that is the difference between a seamless paste-back and a visible patch.
Crop policy differs by role: the main image uses pad/fill because you do not want to lose content, while the reference image uses crop.
Stage 2: repaint, text-only or with a reference
Text-only guidance works: the author's example turns an astronaut into a woman.
For object transfer, add a second image as the reference input. This is the "everything transfer" mode.
The image feeding is done through a preparer node rather than wiring straight into the text encode, and it accepts a mask input natively.
The numbers that matter
Longest-edge limit 2048: this is an upper bound on the longest edge to avoid running out of VRAM or producing bad results, not a resize. The author finds 2048 rendering fine on 2511 - except a 2048x2048 square.
384 is the visual encoder's encoding size. It was the same on 2509, which the author reads as 2511 having no major architectural change.
Model: 2511 plus the 4-step accelerator - the configuration he has used since day one.
Want a bigger repaint block? Raise the initial image size at the start; the crop that follows grows with it.
How to run it
- Open the repaint-and-paste-back graph and load the target image.
- Right-click into the mask editor and paint the region you want to change.
- Write the prompt; add a reference image if you are transferring an object.
- Keep the longest-edge limit at 2048 as a VRAM guard rather than a resize.
- Run: the graph crops a padded square, repaints it with 2511 + the 4-step accelerator, and pastes it back.
- If the repainted block is too small, raise the initial image size rather than editing the crop settings.
Parameter basis
重绘贴回 2511局部重绘 万物迁移 - 54 nodes
| Item | Value (from JSON) |
|---|---|
| UNET loader |
qwen_image_edit_2511_fp8mixed.safetensors / default |
| CLIP loader |
qwen_2.5_vl_7b_fp8_scaled.safetensors / qwen_image |
| VAE | qwen_image_vae.safetensors |
| KSampler | steps 4 · cfg 1 · euler · sgm_uniform · denoise 1 |
| LoRA |
Qwen-Edit-2511-Lightning-4steps-V1.0-bf16.safetensors @ 1 |
重绘贴回 2511局部重绘 - 55 nodes
| Item | Value (from JSON) |
|---|---|
| UNET loader |
qwen_image_edit_2511_bf16.safetensors / default |
| CLIP loader |
qwen_2.5_vl_7b_fp8_scaled.safetensors / qwen_image |
| VAE | qwen_image_vae.safetensors |
| KSampler | steps 4 · cfg 1 · euler · sgm_uniform · denoise 1 |
| LoRA |
Qwen-Edit-2511-Lightning-4steps-V1.0-bf16.safetensors @ 1; Qwen-edit-2511-multiple-angles.safetensors @ 1 |
Honest limits
- Depends on a third-party node plugin; without it the native ComfyUI route does not work (per the author's own attempt).
- A 2048x2048 square is called out as the case that does not hold up.
- Paste-back seams depend on the padded crop; moving or resizing the block afterwards breaks the alignment.
- The "strongest open-source edit model" framing is the author's opinion, not a measured comparison.
Episode resources
- RunningHub - 重绘贴回 2511局部重绘 万物迁移: https://www.runninghub.ai/post/2017885601479004162/?inviteCode=rh-v1111
- RunningHub - 重绘贴回 2511局部重绘: https://www.runninghub.ai/post/2018213964676603905/?inviteCode=rh-v1111
- YouTube tutorial: https://www.youtube.com/watch?v=nlkrfEaScM0
- Bilibili original: https://www.bilibili.com/video/BV1SK68BwE33
來源:DEV Community · dev.to