AI 图片智能编辑工具 IOPaint(持续更新)

IOPaint 是一款免费开源的 AI 图像修复与生成工具,支持擦除物体智能填充局部替换外扩绘图等功能,可在本地运行,适合去除水印、修补照片、移除多余物体。

核心功能

  • 擦除(Erase):用 LaMa 等模型去除水印、路人、杂物
  • 替换(Inpaint):用 PowerPaint、Stable Diffusion 等在遮罩区域重绘
  • 文字绘制:AnyText 支持在图片上添加指定文字
  • 外扩(Outpainting):扩展画面边界,补齐内容

安装与启动

# 使用 GPU 需先安装 CUDA 版 PyTorch
# pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu118

pip3 install iopaint
iopaint start --model=lama --device=cpu --port=8080

访问 http://localhost:8080 使用 Web 界面。


模型选择

模型 用途
LaMa 擦除物体,速度快
PowerPaint 替换/外扩,效果好
AnyText 在图中绘制文字
BrushNet 高级填充

首次启动会自动下载模型,可用 --model-dir 指定下载目录。


插件

# 启动时启用插件
iopaint start --model=lama --enable-interactive-seg --interactive-seg-device=cuda

常用插件:

  • Segment Anything:精确分割物体
  • RemoveBG:抠图、去背景
  • RealESRGAN:超分辨率
  • GFPGAN:人脸修复

批处理

iopaint run --model=lama --device=cpu \
  --image=/path/to/image_folder \
  --mask=/path/to/mask_folder \
  --output=output_dir

--image 为图片目录,--mask 为对应遮罩目录(黑白图,白色为需处理区域)。


其他

  • Windows 一键安装:官网提供 exe 安装包
  • macOS/iOS App:OptiClean 基于 IOPaint
  • Lama Cleaner:IOPaint 的前身项目,文档可参考 https://lama-cleaner-docs.vercel.app/

官方资料