mirror of
https://github.com/wiltodelta/remove-ai-watermarks.git
synced 2026-05-20 20:04:40 +02:00
e5d8970add638ebdccf23dc26018a90f21c7cc70
- CLI with visible, invisible, all, metadata, and batch commands - Gemini watermark removal via reverse alpha blending - Invisible watermark removal via diffusion regeneration (SynthID, TreeRing) - AI metadata stripping (EXIF, PNG text, C2PA) - Face protection (YOLO/Haar) and analog humanizer - 137 tests covering all CLI modes and core engines - Ruff and Pyright clean
Remove-AI-Watermarks
Unified tool for removing visible and invisible AI watermarks from images.
Features
- Visible watermark removal — Gemini sparkle logo via reverse alpha blending (fast, offline, deterministic)
- Invisible watermark removal — SynthID, StableSignature, TreeRing via diffusion-based regeneration
- AI metadata stripping — EXIF, PNG text chunks, C2PA provenance manifests
- Analog Humanizer — film grain and chromatic aberration injection to bypass AI image classifiers
- Smart Face Protection — automatic extraction and blending of human faces to prevent AI distortion
- High-Res Upscaler — prevents resolution degradation during invisible watermark removal
- Batch processing — process entire directories
- Detection — three-stage NCC watermark detection with confidence scoring
Examples
| Before (Watermarked) | After (Cleaned) |
|---|---|
![]() |
![]() |
Installation
Recommended (macOS)
Install as an isolated CLI tool — no need to manage virtual environments:
# Using pipx (brew install pipx)
pipx install git+https://github.com/wiltodelta/remove-ai-watermarks.git
# Or using uv (brew install uv)
uv tool install git+https://github.com/wiltodelta/remove-ai-watermarks.git
Install from repository (macOS)
Prerequisites: Python 3.10+ and pip (or uv).
# 1. Clone the repository
git clone https://github.com/wiltodelta/remove-ai-watermarks.git
cd remove-ai-watermarks
# 2. Install the package in editable mode
pip install -e .
# Or, if you use uv:
uv pip install -e .
After installation the remove-ai-watermarks command is available system-wide.
Invisible watermark removal (optional)
Invisible removal uses diffusion models and requires a HuggingFace token and a decent GPU (CUDA) or Apple Silicon (MPS).
# 1. Create a free token at https://huggingface.co/settings/tokens
# 2. Copy the example env file and paste your token
cp .env.example .env
# Edit .env and set HF_TOKEN=hf_your_token_here
# 3. On first run, the model (~2 GB) will be downloaded automatically.
# On macOS with Apple Silicon, MPS acceleration is used by default.
# On macOS without GPU, add --device cpu (inference will be slow).
Developer setup
# Install with dev dependencies (pytest, ruff, pyright)
pip install -e ".[dev]"
# Or with uv:
uv pip install -e ".[dev]"
# Run tests
pytest
# Run linters
./maintain.sh
Usage
CLI
# Remove visible Gemini watermark
remove-ai-watermarks visible image.png -o clean.png
# Remove invisible watermarks (SynthID etc.) with optimal quality retention
remove-ai-watermarks invisible image.png -o clean.png --humanize 4.0
# Strip AI metadata
remove-ai-watermarks metadata image.png --check
remove-ai-watermarks metadata image.png --remove
# Batch processing
remove-ai-watermarks batch ./images/ --mode visible
# Full pipeline: visible + invisible + metadata
remove-ai-watermarks all image.png -o clean.png
Python API
from remove_ai_watermarks.gemini_engine import GeminiEngine
import cv2
engine = GeminiEngine()
image = cv2.imread("watermarked.png")
# Detect
result = engine.detect_watermark(image)
print(f"Detected: {result.detected} (confidence: {result.confidence:.1%})")
# Remove
clean = engine.remove_watermark(image)
cv2.imwrite("clean.png", clean)
Metadata stripping
from remove_ai_watermarks.metadata import has_ai_metadata, remove_ai_metadata
from pathlib import Path
if has_ai_metadata(Path("image.png")):
remove_ai_metadata(Path("image.png"), Path("clean.png"))
Requirements
- Python ≥ 3.10
- Visible removal / metadata: CPU only, no GPU required
- Invisible removal: GPU recommended (CUDA or MPS), works on CPU (slow)
Credits
- noai-watermark by mertizci — invisible watermark removal
- GeminiWatermarkTool by Allen Kuo — visible watermark removal algorithm
License
MIT
Description
No description provided
aic2paclicomputer-visiondiffusion-modelsgeminiimage-processingmetadatapythonsynthidwatermark-removal
Readme
MIT
39 MiB
Languages
Python
99.9%

