360 Secure SkillHub
360 安全技能中心

Watermark Remover

通过 Python CLI 扫描图片四角区域,用边缘检测与高频分析定位水印并生成掩码,再调用 LaMa 模型或 OpenCV 修复去除;支持单图或目录批量处理、掩码预览与阈值调参,可处理 JPG/PNG/BMP/TIFF/WEBP。需先安装依赖包,LaMa 模型首次运行自动下载。

fusae
fusae
热度 31.40
最近更新 2026-05-20 03:38:56
分类:创作依赖:代码执行 / 读写文件应用场景:图像生成 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add fusae-watermark-remover
Metadata
name
watermark-remover
version
0.1.0
description
Automatically detects and removes watermarks from images using AI-powered inpainting. Use when user asks to "remove watermark", "clean image", or "去水印".

Watermark Remover

Automatically detects watermarks in image corners and removes them using LaMa AI model.

Installation

This skill requires the watermark-remover Python package. Install it first:

# Install from PyPI (when published)
pip install watermark-remover

# Or install from source
git clone https://github.com/yourusername/watermark-remover.git
cd watermark-remover
pip install -e .

Dependencies: Python 3.9+, opencv-python, numpy, Pillow, iopaint

Script Directory

Scripts in scripts/ subdirectory. Replace ${SKILL_DIR} with this SKILL.md's directory path.

Script Purpose
scripts/main.py Watermark removal CLI wrapper

Usage

python ${SKILL_DIR}/scripts/main.py <input> [options]

Options

Option Description Default
<input> Image file or directory Required
--output Output path <input>/no_watermark
--corner-ratio Corner area ratio (0-1) 0.15
--threshold Detection sensitivity (lower = more sensitive) 30
--padding Mask dilation pixels 10
--preview Generate mask preview only false
--no-lama Use OpenCV instead of LaMa false

Examples

# Single image
python ${SKILL_DIR}/scripts/main.py image.jpg

# Directory with custom output
python ${SKILL_DIR}/scripts/main.py ./photos/ --output ./cleaned/

# Preview detection (shows red marks on watermarks)
python ${SKILL_DIR}/scripts/main.py ./photos/ --preview

# Adjust detection sensitivity
python ${SKILL_DIR}/scripts/main.py image.jpg --corner-ratio 0.2 --threshold 20

# Use OpenCV inpaint (faster but lower quality)
python ${SKILL_DIR}/scripts/main.py image.jpg --no-lama

How It Works

  1. Scans image corners (default 15% area)
  2. Detects watermarks using edge detection + high-frequency analysis
  3. Generates precise mask
  4. Removes watermark using LaMa AI model (auto-downloads on first run)
  5. Falls back to OpenCV inpaint if LaMa fails

Supported Formats

JPG, JPEG, PNG, BMP, TIFF, WEBP