AI Repair and Expansion Process
Date: December 15, 2024 Categories: AI-generated imagery
Table of Contents[Hidden]
Preface
The above is the process for AI image repair created by Bilibili user 垌月岚的蟹黄堡秘方. It is a redrawing process aimed at repairing manga, designed to assist MAD and subtitle groups. The tutorial covers everything from software installation to using the process, helping you get started and efficiently complete the repair of MAD materials using the tools.
The model used in this process is the Flux_Fill model, currently the most powerful open-source model for redrawing and image expansion, with 120E parameters, and can be deployed locally.
You can first check the Feishu document to get the basic process, shared information, and effect demonstrations.
Model VRAM Usage Test (subjective and for reference only) ⬇
ComfyUI Installation Method
For more detailed installation methods and how to use ComfyUI, you can watch the beginner's tutorial and read the articles by Bilibili user 醉石散客 to understand the basic principles and concepts.
Project links for the plugins and models used ⬇
- clip:https://huggingface.co/comfyanonymous/flux_text_encoders/tree/main
- vae:https://huggingface.co/black-forest-labs/FLUX.1-schnell/blob/main/ae.safetensors
- Fill:https://huggingface.co/black-forest-labs/FLUX.1-Fill-dev/tree/main
- T8 Quantized Fill:https://huggingface.co/t8star
- FluxExt-MZ:https://github.com/MinusZoneAI/ComfyUI-FluxExt-MZ
- RMBG2.0:https://github.com/gorillaframeai/GF_nodes
- BEN:https://github.com/DoctorDiffusion/ComfyUI-BEN
- Inspyrenet:https://github.com/john-mnz/ComfyUI-Inspyrenet-Rembg
- BiRefnet v2:https://github.com/ZhengPeng7/BiRefNet
If you don't have a proxy, you can download it from the cloud storage.
Here is the text version example of the installation process:
In the cloud storage, there are these folders. First, select and download the launcher; both are Qiuye's HuiShi launchers.
① is the latest version 1.5 by Qiuye, which hasn't undergone file and plugin configuration. You can first watch the beginner's tutorial to get started.
② is the compressed package where I used Qiuye's 1.5 version, removed some files, and installed certain plugins. Since the model files are too large, I removed them for separate downloading.

Effect Display
You can view the detailed images on Feishu.
Redrawing Effect ⬇
Image Expansion Effect ⬇
Image Masking Effect ⬇
Installation Tutorial
Basic Files
Next, we proceed with the necessary model downloads. The required files include clip, VAE, and UNet (the UNet file is divided into the original model and the quantized model; download the one that suits your VRAM). After downloading, place the files into the root directory folder of ComfyUI as follows:
Comfyui\models\clip
Comfyui\models\vae
Comfyui\models\unet
Baidu Cloud Storage File Location ⬇
Plugin Installation
If you are using Qiuye's original launcher, an additional step for plugin installation is required. If you are using the pre-packaged integration package, you can skip this step.
Step 1
Step 2
Step 3
After installing the above plugins, you also need to manually install one more plugin, as it is not included in the ComfyUI library. After downloading the compressed package, unzip it and place the files in this directory ⬇
Comfyui\custom_nodes
Download the plugin from the cloud storage.
Image Masking Files
If you are using the pre-packaged files, you can skip the image masking plugin installation process. If not, just follow the plugin installation guide in the tutorial (PS: Remember to enable magic).
After the plugin installation is complete, simply drag the image masking files into the models folder ⬇
Comfyui\models
Cloud Storage Download Link
NoteNote: Since the plugin will automatically download some models during the image masking process, you need to enable the proxy.Please do not interrupt the proxy.
Usage Instructions
1. Redrawing
Open the HuiShi launcher and run it. When the workspace interface pops up, drag the workflow file (JSON file) into the interface.
Afterward, we will have a workflow like the image below.
PS: The text and boxes are prompt descriptions and workflow thumbnails ⬇
Step 1
Drag the image into the "Load Image" section, right-click, and open the mask editor to draw the mask area. After that, save the changes.
Masking Tips:
Old Version Masking Method ⬇
① When painting the mask:Scroll wheel操控画笔大小
②鼠标左键+Ctrl拖动画布位置
③Alt+鼠标左键进行擦除蒙版
新版蒙版操作方法⬇
①左边工具栏有画笔,橡皮擦,吸管and翻转遮罩工具来绘制蒙版
②在界面右侧有详细的参数调节,类似PS界面
*新版本comfyui有更好的操作界面,推荐自己上手调节或者看视频介绍
Step 2
在蒙版处理部分可以适当进行数值更改(可以保持不动)
Step 3
适当书写提示词,也可以不用写,Flux模型的能力非常的强大
第四步
完成上面步骤之后点击执行队列等待出图即可
Open the HuiShi launcher and run it. When the workspace interface pops up, drag the workflow file (JSON file) into the interface.
Afterward, we will have a workflow like the image below.
PS:文字与方框为提示描述和流程缩略图
Step 1
把图片拖入加载图像
Step 2
修改外补画板的数值,调整想要扩展的方向和范围(点击预览图像圆点可以产看扩展的范围)
Step 3
书写适当的提示词(可以不输入让模型自行理解或者使用适当填写自己的扩展想法或使用反求插件配合使用)
第四步
完成上面步骤之后点击执行队列等待出图即可
使用了BiRefNet V2,Ben,RMBG-2,Inspyrenet四种抠像模型组合在一起,选择合适的抠像结果
输出带有透明通道的png图像和蒙版。
Step 1
打开绘世启动器运行,等到弹出工作界面的时候把工作流程文件(json文件)拖入界面,之后我们得到下图的一个工作流程 PS:文字与方框为提示描述和流程缩略图
Step 2
把图片拖入加载图像
Step 3
完成上面步骤之后点击执行队列等待出图即可
Conclusion
本篇 ComfyUI 教程中,我们基于Flux_Fill的强大图像能力和理解能力,来完成了对于图像的快速补图,扩图处理
使用RMBG2.0、BEN、Inspyrenet、BiRefnet v2来进行简单的图片抠像,但是目前对于动漫类较差。