跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
设计与 UI

image-inpaint-region

Local circular region inpainting with LaMa (IOPaint). Uses IOPaint default InpaintRequest and mask handling. Use for 局部重�/ 局部修�/ inpaint when circle center and radius cx,cy,r are known.

godot-fun · 已有 AI 审核记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add godot-fun/godot-agent --skill image-inpaint-region

技能说明


name: image-inpaint-region description: >- Local circular region inpainting with LaMa (IOPaint). Uses IOPaint default InpaintRequest and mask handling. Use for 局部重�/ 局部修�/ inpaint when circle center and radius cx,cy,r are known.

Image Inpaint Region (LaMa)

Local circular region inpainting with IOPaint LaMa. Builds a circular mask from --region cx,cy,r, then runs the same inference path as iopaint run / the IOPaint API.

Both --image and --region cx,cy,r are required.

Rules

When this skill applies, read and follow skill-dependency-manager �run scripts as documented, install missing tools into .dependency/.

  • Run inpaint.py through the iopaint manifest entry (.dependency/iopaint/.venv/). Never use host python, py, python3, or any interpreter outside .dependency/.
  • Do not hand-write equivalent inpaint commands â€?use the bundled script.
  • Single file only. Pass one image with --image; directories are not supported.
  • Require region first. If --region cx,cy,r is missing, inspect the image (or ask the user) before running.
  • Use IOPaint defaults for inference config unless the user explicitly asks otherwise â€?do not invent custom mask blur, compositing, or hd_strategy overrides in the script.
  • Pass the input path as-is. Output goes to <image-dir>/image-inpaint-region/ by default â€?no path rewriting.
  • Never overwrite source files. Output lands in image-inpaint-region/ or --output.

Setup (first run)

IOPaint needs Python 3.11 and PyTorch. From project root:

.dependency/python-3.11/python.exe -m venv .dependency/iopaint/.venv
.dependency/iopaint/.venv/Scripts/python.exe -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118
.dependency/iopaint/.venv/Scripts/python.exe -m pip install iopaint

CPU-only: skip the CUDA torch line and pip install iopaint (pulls CPU torch). Use bin/python on Unix.

Register in .dependency/manifest.json:

"iopaint": {
  "populated": true,
  "bin": ".dependency/iopaint/.venv/Scripts/python.exe"
}

LaMa weights (big-lama.pt) download on first run.

Quick Start

Both --image and --region are required:

# image/foo.png �image/image-inpaint-region/foo.png
# center (148, 248), radius 48
.dependency/iopaint/.venv/Scripts/python.exe .ai/image-inpaint-region/inpaint.py --image image/foo.png --region 148,248,48

GPU inference:

.dependency/iopaint/.venv/Scripts/python.exe .ai/image-inpaint-region/inpaint.py --image image/foo.png --region 148,248,48 --device cuda

Custom output path:

.dependency/iopaint/.venv/Scripts/python.exe .ai/image-inpaint-region/inpaint.py --image image/foo.png --region 148,248,48 -o image/foo_inpainted

How it works

  1. Open the image as RGB (same as iopaint batch processing).
  2. Draw a filled circle mask from --region cx,cy,r.
  3. Binarize mask at 127 (same as iopaint.batch_processing / API).
  4. Call ModelManager with InpaintRequest() defaults.
  5. Write PNG via pil_to_bytes(..., "png", 100, ...).

IOPaint defaults used

These come from InpaintRequest() and iopaint run �the script does not override them:

SettingDefaultNotes
--modellamaSame as iopaint run
--devicecpuSame as iopaint run / start; use --device cuda when GPU is available
hd_strategyCropLaMa erase-model preprocessing
hd_strategy_crop_trigger_size800Crop when long side > 800 px
hd_strategy_crop_margin128Margin around mask for crop strategy
Mask threshold127>= 127 �255, else 0

The skill only adds --region cx,cy,r so you do not need a separate mask file.

Options

OptionDefaultNotes
--imageRequiredSingle supported image file
--regionRequiredcx,cy,r �center x, center y, radius in pixels
Output<image-dir>/image-inpaint-region/<name>.pngUse -o / --output for custom file or directory
--modellamaIOPaint model name
--devicecpucpu or cuda (falls back via IOPaint check_device)

Supported inputs: .png, .jpg, .jpeg, .webp, .gif, .bmp, .tif, .tiff, .avif, .ico.

Agent Workflow

  1. Confirm source �user path only; do not copy into image/ or use chat attachment cache.
  2. Confirm region �inspect the image and determine circle center (cx, cy) and radius r before running.
  3. One file per run �process one image, verify the result, then repeat for additional files if needed.
  4. Inspect �check the inpainted area; leftover content �larger r; nearby art eaten �smaller r or move center.
  5. Revert �delete the output file or git restore; sources are never modified.

Agent Notes

  1. Use the bundled script, not hand-written IOPaint CLI with separate mask files unless the user already has a mask image.
  2. Missing iopaint venv �populate .dependency/ per skill-dependency-manager, retry same command.
  3. Do not copy, move, or replace the source with inpainted output �tell the user where the output file is.
  4. For full IOPaint UI / brush mask editing, use the upstream iopaint start workflow instead.

Troubleshooting

IssueFix
iopaint missing / not populatedFollow Setup; update manifest
Missing --regionInspect image; both --image and --region cx,cy,r are required
Invalid --regionMust be three numbers: center x, center y, radius (> 0)
Directory passed to --imageRun once per file; this skill accepts image files only
Output already existsDelete the existing output or choose a different -o path
CUDA not availableIOPaint falls back to cpu via check_device
Target still vi
阅读完整来源 ↗