watermark-removal
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUniversal Watermark Removal
通用水印移除工具
Remove watermarks from ANY image source using intelligent detection and proven methods. Smart routing: automatically detects Google SynthID and uses the proven aggressive method, falls back to ML inpainting for unknown watermark types.
借助智能检测与成熟的处理方式,移除任意图片来源的水印。智能路由机制:自动检测Google SynthID水印并采用经验证的aggressive处理方式,针对未知类型水印则默认使用ML修复方式。
Quick Start
快速开始
Single Image - Smart Auto-Detection (Recommended)
单张图片 - 智能自动检测(推荐)
bash
undefinedbash
undefinedSmart detection: Google SynthID → aggressive method (proven), Unknown → inpaint (ML)
智能检测:Google SynthID → aggressive方式(经验证有效),未知水印 → inpaint(ML修复)
python .claude/skills/watermark-removal/scripts/remove-watermark.py
input.png
output.png
input.png
output.png
undefinedpython .claude/skills/watermark-removal/scripts/remove-watermark.py
input.png
output.png
input.png
output.png
undefinedSingle Image - Preserve Dimensions (Force ML)
单张图片 - 保留尺寸(强制使用ML修复)
bash
undefinedbash
undefinedForce ML inpainting even for Google SynthID (preserves exact dimensions)
即使是Google SynthID水印也强制使用ML修复(保留精确尺寸)
python .claude/skills/watermark-removal/scripts/remove-watermark.py
input.png
output.png
--method inpaint
input.png
output.png
--method inpaint
undefinedpython .claude/skills/watermark-removal/scripts/remove-watermark.py
input.png
output.png
--method inpaint
input.png
output.png
--method inpaint
undefinedBatch Processing (Get User Approval First!)
批量处理(需先获得用户许可!)
⚠️ IMPORTANT: Always ask user before batch processing, especially with crop/aggressive methods that alter dimensions.
bash
undefined⚠️ 重要提示: 批量处理前务必询问用户,尤其是使用会改变尺寸的crop/aggressive方式时。
bash
undefinedRecommended: Preserves dimensions
推荐:保留尺寸
python .claude/skills/watermark-removal/scripts/batch-process.py
/path/to/input-dir
/path/to/output-dir
--method inpaint
/path/to/input-dir
/path/to/output-dir
--method inpaint
python .claude/skills/watermark-removal/scripts/batch-process.py
/path/to/input-dir
/path/to/output-dir
--method inpaint
/path/to/input-dir
/path/to/output-dir
--method inpaint
Alternative: Fast but crops 120px (requires user approval)
备选:快速处理但会裁剪120像素(需用户许可)
python .claude/skills/watermark-removal/scripts/batch-process.py
/path/to/input-dir
/path/to/output-dir
--method aggressive
/path/to/input-dir
/path/to/output-dir
--method aggressive
undefinedpython .claude/skills/watermark-removal/scripts/batch-process.py
/path/to/input-dir
/path/to/output-dir
--method aggressive
/path/to/input-dir
/path/to/output-dir
--method aggressive
undefinedSmart Detection System ⭐ NEW
智能检测系统 ⭐ 新增功能
The skill automatically detects Google SynthID watermarks and routes to the optimal removal method:
该工具可自动检测Google SynthID水印,并选择最优移除方式:
Google SynthID Detection
Google SynthID检测
Characteristics analyzed:
- RGBA mode (PNG format with alpha channel)
- Large dimensions (>1500px width and height)
- Typical Google AI aspect ratios (1.83, 1.0, 1.5, 1.78 with 10% tolerance)
- Automatic corner detection for watermark location
Smart routing logic:
-
If Google SynthID detected → Usesmethod (proven to work perfectly)
aggressive- Crops 120px from detected corner
- Removes alpha channel watermarking
- Paints over any remnants
- Works 100% reliably on Google AI images
-
If unknown/other watermark → Usesmethod (ML-based)
inpaint- Preserves exact dimensions
- Uses OpenCV Navier-Stokes algorithm
- Works on any watermark type
分析特征:
- RGBA模式(带透明通道的PNG格式)
- 大尺寸(宽高均>1500像素)
- Google AI典型宽高比(1.83、1.0、1.5、1.78,误差容忍度10%)
- 自动检测水印所在角落位置
智能路由逻辑:
-
检测到Google SynthID水印 → 使用方式(经验证可完美移除)
aggressive- 从检测到的角落裁剪120像素
- 移除透明通道水印
- 修复残留痕迹
- 对Google AI图片的处理成功率100%
-
未知/其他类型水印 → 使用方式(基于ML)
inpaint- 保留精确尺寸
- 使用OpenCV Navier-Stokes算法
- 支持任意类型水印
Override Default Behavior
覆盖默认行为
bash
undefinedbash
undefinedForce ML inpainting even for Google SynthID (preserves dimensions)
即使是Google SynthID水印也强制使用ML修复(保留尺寸)
python scripts/remove-watermark.py input.png output.png --method inpaint
python scripts/remove-watermark.py input.png output.png --method inpaint
Force aggressive method for non-Google watermarks
对非Google水印强制使用aggressive方式
python scripts/remove-watermark.py input.png output.png --method aggressive
python scripts/remove-watermark.py input.png output.png --method aggressive
Disable auto-detection (assume bottom-right corner)
禁用自动检测(默认假设水印在右下角)
python scripts/remove-watermark.py input.png output.png --no-detect
undefinedpython scripts/remove-watermark.py input.png output.png --no-detect
undefinedMethods
处理方式
Inpaint Method (Best Quality) ⭐ NEW
Inpaint方式(画质最佳)⭐ 新增功能
What it does: ML-based inpainting with automatic watermark detection
Features:
- Automatically detects watermark location (any corner)
- Uses OpenCV's Navier-Stokes inpainting algorithm
- Intelligently fills watermark area with surrounding patterns
- Works on ANY watermark type (not just Google SynthID)
Pros:
- Highest quality results
- Preserves exact dimensions
- Works on watermarks in any corner
- Handles complex backgrounds intelligently
- Universal - works on all watermark types
Cons:
- Requires OpenCV installation ()
pip install opencv-python - Slightly slower than crop method
- May need parameter tuning for very large watermarks
Use when:
- You need the best possible quality
- Watermark is on complex/detailed background
- Preserving exact dimensions is critical
- Working with non-Google watermarks
工作原理: 基于ML的修复技术,搭配自动水印检测
特性:
- 自动检测水印位置(任意角落)
- 使用OpenCV的Navier-Stokes修复算法
- 智能利用周边图案填充水印区域
- 支持任意类型水印(不仅限于Google SynthID)
优势:
- 画质最佳
- 保留精确尺寸
- 支持任意角落的水印
- 智能处理复杂背景
- 通用性强,支持所有水印类型
劣势:
- 需要安装OpenCV()
pip install opencv-python - 比crop方式稍慢
- 超大水印可能需要调整参数
适用场景:
- 追求最佳画质
- 水印位于复杂/细节丰富的背景上
- 保留精确尺寸至关重要
- 处理非Google水印
Aggressive Method (Fast & Reliable)
Aggressive方式(快速可靠)
What it does: Auto-detects corner, crops 120px, removes alpha channel, paints remnants
Pros:
- Fast and reliable
- Automatic detection of watermark corner
- Handles RGBA images properly
- Good for batch processing
Cons:
- Reduces image size by 120px
- May crop content near edges
Use when:
- Processing many images quickly (default for batch)
- Size reduction is acceptable
- Google SynthID watermarks
工作原理: 自动检测角落,裁剪120像素,移除透明通道,修复残留痕迹
优势:
- 快速可靠
- 自动检测水印所在角落
- 正确处理RGBA图片
- 适合批量处理
劣势:
- 图片尺寸缩小120像素
- 可能裁剪边缘附近的内容
适用场景:
- 快速处理大量图片(批量处理默认方式)
- 尺寸缩小可接受
- 处理Google SynthID水印
Crop Method
Crop方式
What it does: Auto-detects and crops watermark corner
Pros:
- Fastest method
- Automatic detection
- Minimal processing
Cons:
- May leave watermark remnants
- Doesn't handle alpha channel watermarking
Use when:
- Speed is top priority
- Quick preview needed
工作原理: 自动检测并裁剪水印所在角落
优势:
- 速度最快
- 自动检测
- 处理步骤最少
劣势:
- 可能残留水印痕迹
- 无法处理透明通道水印
适用场景:
- 优先考虑速度
- 需要快速预览
Paint Method
Paint方式
What it does: Paints over watermark without cropping (no auto-detection)
Pros:
- Preserves dimensions
- Simple approach
Cons:
- Assumes bottom-right corner only
- May leave visible artifacts
- Less reliable than inpaint
Use when:
- Simple watermarks on solid backgrounds
- Legacy compatibility
工作原理: 在不裁剪的情况下覆盖水印(无自动检测)
优势:
- 保留尺寸
- 操作简单
劣势:
- 仅默认水印在右下角
- 可能留下可见痕迹
- 可靠性低于inpaint方式
适用场景:
- 纯色背景上的简单水印
- 兼容旧版需求
Important Guidelines
重要指南
Dimension Preservation Priority
尺寸保留优先级
BALANCE DOMAIN KNOWLEDGE WITH DIMENSION PRESERVATION
-
Smart default behavior:
- Google SynthID detected → method (proven perfect, crops 120px)
aggressive - Unknown watermark → method (preserves dimensions)
inpaint
- Google SynthID detected →
-
User override available:
- Force dimension preservation with flag
--method inpaint - Force cropping with flag
--method aggressive
- Force dimension preservation with
-
User approval required for batch cropping:
- If processing multiple Google SynthID images with aggressive method
- Explain that method will reduce image size by 120px
- Get explicit confirmation
- Show before/after dimensions
平衡领域知识与尺寸保留需求
-
智能默认行为:
- 检测到Google SynthID水印 → 使用方式(经验证完美,裁剪120像素)
aggressive - 未知类型水印 → 使用方式(保留尺寸)
inpaint
- 检测到Google SynthID水印 → 使用
-
支持用户覆盖:
- 使用参数强制保留尺寸
--method inpaint - 使用参数强制裁剪
--method aggressive
- 使用
-
批量裁剪需用户许可:
- 若使用aggressive方式批量处理Google SynthID图片
- 需说明该方式会将图片尺寸缩小120像素
- 获取明确确认
- 展示处理前后的尺寸
Batch Processing Protocol
批量处理流程
NEVER start batch processing without user confirmation:
-
Show what will happen:
- Number of images to process
- Method to be used
- Whether dimensions will be preserved or altered
-
Get explicit approval:
- "I will process X images using [method]. This [will/will not] alter dimensions. Proceed?"
-
Prefer non-destructive:
- Default to for batch processing
inpaint - Only use if user specifically requests speed over quality
aggressive
- Default to
未经用户确认绝不要启动批量处理:
-
告知处理内容:
- 待处理图片数量
- 将要使用的处理方式
- 是否会改变尺寸
-
获取明确许可:
- “我将使用[方式]处理X张图片,该方式[会/不会]改变尺寸。是否继续?”
-
优先选择非破坏性方式:
- 批量处理默认使用方式
inpaint - 仅当用户明确要求速度优先于画质时才使用方式
aggressive
- 批量处理默认使用
Workflow
工作流程
1. Identify Watermarked Images
1. 识别带水印的图片
Common watermark types:
- Google SynthID: Small star/sparkle icon in corner
- Stock photos: Logo or text overlay
- AI services: Corner badges (Midjourney, DALL-E)
- Camera watermarks: Date/time stamps
常见水印类型:
- Google SynthID: 角落的小星星/闪光图标
- 图库图片: 商标或文字叠加层
- AI服务: 角落标识(Midjourney、DALL-E)
- 相机水印: 日期/时间戳
2. Choose Method
2. 选择处理方式
Smart Default Workflow (NEW):
- Run script without --method flag - Smart detection automatically routes to best method
- Google SynthID detected → Uses method (proven perfect)
aggressive - Unknown watermark → Uses method (ML-based, preserves dimensions)
inpaint - Override with --method flag if needed
Method Selection Guide:
- Smart auto (recommended): No flag (detects Google SynthID → aggressive, else → inpaint)
- Force dimension preservation: (ML-based, works on any watermark)
--method inpaint - Force Google method: (crops 120px, perfect for SynthID)
--method aggressive - Maximum speed: (fastest, crops but may leave remnants)
--method crop - Legacy: (basic, preserves dimensions but less reliable)
--method paint
智能默认流程(新增):
- 不带--method参数运行脚本 - 智能检测自动选择最佳方式
- 检测到Google SynthID水印 → 使用方式(经验证完美)
aggressive - 未知类型水印 → 使用方式(基于ML,保留尺寸)
inpaint - 必要时使用--method参数覆盖默认设置
处理方式选择指南:
- 智能自动(推荐): 不带参数(检测到Google SynthID→aggressive,其他→inpaint)
- 强制保留尺寸: (基于ML,支持任意水印)
--method inpaint - 强制使用Google专属方式: (裁剪120像素,完美处理SynthID)
--method aggressive - 最快速度: (速度最快,裁剪但可能残留痕迹)
--method crop - 旧版兼容: (基础方式,保留尺寸但可靠性较低)
--method paint
3. Process Images
3. 处理图片
Smart auto-detection (recommended):
bash
python scripts/remove-watermark.py input.png output.pngForce dimension preservation:
bash
python scripts/remove-watermark.py input.png output.png --method inpaintFast batch processing:
bash
python scripts/batch-process.py ./input ./output --method aggressiveDisable auto-detection (force bottom-right):
bash
python scripts/remove-watermark.py input.png output.png --method inpaint --no-detect智能自动检测(推荐):
bash
python scripts/remove-watermark.py input.png output.png强制保留尺寸:
bash
python scripts/remove-watermark.py input.png output.png --method inpaint快速批量处理:
bash
python scripts/batch-process.py ./input ./output --method aggressive禁用自动检测(强制假设水印在右下角):
bash
python scripts/remove-watermark.py input.png output.png --method inpaint --no-detect4. Verify Results
4. 验证结果
- Check output images for clean corners
- Verify no important content was cropped
- Confirm watermark fully removed
- 检查输出图片的角落是否干净
- 确认边缘附近的重要内容未被裁剪
- 确认水印已完全移除
Command Reference
命令参考
remove-watermark.py
remove-watermark.py
bash
python scripts/remove-watermark.py INPUT OUTPUT [OPTIONS]
Arguments:
INPUT Input image path
OUTPUT Output image path
Options:
--method {crop|inpaint} Removal method (default: crop)
--size INT Watermark size in pixels (default: 60)bash
python scripts/remove-watermark.py INPUT OUTPUT [OPTIONS]
参数:
INPUT 输入图片路径
OUTPUT 输出图片路径
选项:
--method {crop|inpaint} 移除方式(默认:crop)
--size INT 水印尺寸(像素,默认:60)batch-process.py
batch-process.py
bash
python scripts/batch-process.py INPUT_DIR OUTPUT_DIR [OPTIONS]
Arguments:
INPUT_DIR Directory with images to process
OUTPUT_DIR Directory for cleaned images
Options:
--method {crop|inpaint} Removal method (default: crop)
--pattern PATTERN File pattern to match (default: *.png)
--size INT Watermark size in pixels (default: 60)bash
python scripts/batch-process.py INPUT_DIR OUTPUT_DIR [OPTIONS]
参数:
INPUT_DIR 待处理图片目录
OUTPUT_DIR 清理后图片的保存目录
选项:
--method {crop|inpaint} 移除方式(默认:crop)
--pattern PATTERN 匹配的文件格式(默认:*.png)
--size INT 水印尺寸(像素,默认:60)Examples
示例
Example 1: Website Images
示例1:网站图片处理
Scenario: User has 3 Google AI images for website, watermarks need removal
bash
undefined场景: 用户有3张用于网站的Google AI图片,需要移除水印
bash
undefinedBatch process all PNG images
批量处理所有PNG图片
python scripts/batch-process.py
./public/images
./public/images-clean
--method crop
--pattern "*.png"
./public/images
./public/images-clean
--method crop
--pattern "*.png"
**Output:**Found 3 images to process
Input: ./public/images
Output: ./public/images-clean
Method: crop
[1/3] Processing: ad-design-bedroom.png
✅ Saved to: ad-design-bedroom.png
[2/3] Processing: ad-design-kitchen.png
✅ Saved to: ad-design-kitchen.png
[3/3] Processing: ad-designs-bathroom.png
✅ Saved to: ad-designs-bathroom.png
✅ Successfully processed: 3/3
undefinedpython scripts/batch-process.py
./public/images
./public/images-clean
--method crop
--pattern "*.png"
./public/images
./public/images-clean
--method crop
--pattern "*.png"
**输出:**找到3张待处理图片
输入目录: ./public/images
输出目录: ./public/images-clean
处理方式: crop
[1/3] 处理中: ad-design-bedroom.png
✅ 保存至: ad-design-bedroom.png
[2/3] 处理中: ad-design-kitchen.png
✅ 保存至: ad-design-kitchen.png
[3/3] 处理中: ad-designs-bathroom.png
✅ 保存至: ad-designs-bathroom.png
✅ 处理完成: 3/3
undefinedExample 2: Preserve Exact Dimensions
示例2:保留精确尺寸
Scenario: Client needs exact 1920x1080 image, can't crop
bash
python scripts/remove-watermark.py \
hero-image.png \
hero-image-clean.png \
--method inpaint场景: 客户需要精确的1920x1080图片,不能裁剪
bash
python scripts/remove-watermark.py \
hero-image.png \
hero-image-clean.png \
--method inpaintExample 3: Larger Watermark
示例3:超大水印处理
Scenario: Watermark is bigger than usual (70px)
bash
python scripts/batch-process.py \
./images \
./images-clean \
--method crop \
--size 70场景: 水印尺寸比常规大(70像素)
bash
python scripts/batch-process.py \
./images \
./images-clean \
--method crop \
--size 70Technical Details
技术细节
See references/synthid-watermark.md for:
- SynthID watermark specifications
- Method comparison details
- Edge cases and considerations
- Legal/ethical guidelines
查看references/synthid-watermark.md获取:
- SynthID水印规格
- 处理方式对比细节
- 边缘情况与注意事项
- 法律/伦理指南
Dependencies
依赖项
Required:
- Python 3.7+
- Pillow (PIL):
pip install Pillow - NumPy:
pip install numpy
Optional (for ML inpainting):
- OpenCV:
pip install opencv-python
Install all dependencies:
bash
pip install Pillow numpy opencv-pythonNote: The method requires OpenCV. Other methods work without it.
inpaint必需:
- Python 3.7+
- Pillow (PIL):
pip install Pillow - NumPy:
pip install numpy
可选(用于ML修复):
- OpenCV:
pip install opencv-python
安装所有依赖项:
bash
pip install Pillow numpy opencv-python注意: 方式需要OpenCV。其他方式无需安装。
inpaintTips
技巧
Performance:
- Crop method is 5-10x faster than inpaint
- For 100+ images, use crop method
Quality:
- Save with quality=95 to minimize compression
- PNG format preserves quality better than JPEG
Backup:
- Always keep original watermarked images
- Process copies, not originals
Testing:
- Test on one image before batch processing
- Verify watermark size with flag if needed
--size
性能:
- Crop方式比inpaint方式快5-10倍
- 处理100张以上图片时,使用crop方式
画质:
- 保存时设置quality=95以最小化压缩损失
- PNG格式比JPEG格式更能保留画质
备份:
- 始终保留带水印的原始图片
- 处理副本而非原图
测试:
- 批量处理前先测试单张图片
- 必要时使用参数验证水印尺寸
--size