Skip to main content

Remove visible and invisible AI watermarks from images (Gemini / Nano Banana, ChatGPT, Stable Diffusion)

Project description

Remove-AI-Watermarks

Remove visible and invisible AI watermarks from images generated by Google Gemini (Nano Banana), ChatGPT / DALL-E, Stable Diffusion, Adobe Firefly, Midjourney, and other AI models.

Strips SynthID, C2PA Content Credentials, EXIF/XMP "Made with AI" labels, and visible sparkle overlays — all in one command.

Features

  • Visible watermark removal — Gemini / Nano Banana 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, XMP DigitalSourceType
  • "Made with AI" label removal — removes the metadata that triggers AI labels on Instagram, Facebook, X (Twitter)
  • Analog Humanizer — film grain and chromatic aberration to bypass AI image classifiers
  • Smart Face Protection — automatic extraction and blending of human faces to prevent AI distortion
  • Batch processing — process entire directories
  • Detection — three-stage NCC watermark detection with confidence scoring

Try it online — don't want to install anything? Use raiw.cc, a free web service powered by this library.

Examples

Before (Watermarked) After (Cleaned)
Before After

Supported models

AI model Visible watermark Invisible watermark Metadata Our approach
Google Gemini / Nano Banana ✅ Sparkle logo ✅ SynthID ✅ C2PA + EXIF Alpha reversal + diffusion + metadata strip
OpenAI DALL-E 3 / ChatGPT ✅ C2PA manifest Metadata strip
OpenAI ChatGPT Images 2.0 (gpt-image-2) ⚠️ imperceptible pixel watermark (no public detector yet) ✅ C2PA manifest (verified) Diffusion regeneration + metadata strip
Stable Diffusion (AUTOMATIC1111, ComfyUI) ✅ DWT / steganographic ✅ PNG text chunks Diffusion regeneration + metadata strip
Adobe Firefly ✅ Content Credentials (C2PA) Metadata strip
Midjourney ✅ EXIF + XMP (prompt, model, seed) Metadata strip
StableSignature (Meta) ✅ In-model watermark Diffusion regeneration
TreeRing ✅ Latent space watermark Diffusion regeneration

Visible watermarks (logo overlays) are currently used only by Google Gemini / Nano Banana. Other services rely on invisible watermarks and/or metadata. Our diffusion-based regeneration works against any invisible watermark in pixel or frequency domain.

How it works

Removing the Gemini / Nano Banana sparkle watermark

Google Gemini (internally codenamed Nano Banana) adds a visible sparkle logo to generated images using alpha blending:

watermarked = α × logo + (1 − α) × original

We reverse this with a known alpha map (extracted from Gemini / Nano Banana output on a pure-black background):

original = (watermarked − α × logo) / (1 − α)

A three-stage NCC (Normalized Cross-Correlation) detector finds the watermark position and scale dynamically, so it works even if the image was resized or cropped. After removal, residual sparkle-edge artifacts are cleaned via gradient-masked inpainting.

Speed: ~0.05s per image. No GPU needed.

Removing SynthID and other invisible watermarks

Google embeds SynthID into every image generated by Gemini / Nano Banana. Other AI services use StableSignature, TreeRing, and similar schemes. These imperceptible frequency-domain patterns survive cropping, resizing, and JPEG compression.

The removal pipeline:

image → downscale to 768px → encode to latent space (VAE)
      → add controlled noise (forward diffusion)
      → denoise (reverse diffusion, ~2 steps at strength 0.02)
      → decode back to pixels (VAE) → upscale to original resolution

The key insight: even minimal noise injection (strength 0.02 = 2% perturbation) breaks the watermark signal while preserving visual quality. The diffusion model acts as a learned image prior — it reconstructs the image faithfully while destroying the watermark pattern.

Face Protection: before diffusion, YOLO detects people in the image and extracts them. After diffusion, the original faces are blended back with a soft elliptical mask to prevent AI distortion of facial features.

Analog Humanizer: optional film grain and chromatic aberration injection that makes the output indistinguishable from a photo of a screen, defeating AI-generated image classifiers.

Stripping C2PA, EXIF, and "Made with AI" metadata

AI tools embed generation metadata that social platforms use to show "Made with AI" labels:

  • EXIF tags — prompt, seed, model hash, sampler settings (Stable Diffusion, Midjourney)
  • XMP DigitalSourceTypetrainedAlgorithmicMedia tag used by Instagram, Facebook, and X (Twitter) to show "Made with AI"
  • PNG text chunks — ComfyUI workflows, AUTOMATIC1111 parameters
  • C2PA Content Credentials — cryptographic provenance manifests from Google Imagen, OpenAI DALL-E, Adobe Firefly

The cleaner parses each layer, removes AI-related fields, and preserves standard metadata (Author, Copyright, Title).

Installation

Recommended

Install as an isolated CLI tool — no need to manage virtual environments:

# Using pipx (https://pipx.pypa.io)
pipx install git+https://github.com/wiltodelta/remove-ai-watermarks.git

# Or using uv (https://docs.astral.sh/uv)
uv tool install git+https://github.com/wiltodelta/remove-ai-watermarks.git

To update to the latest version:

pipx upgrade remove-ai-watermarks

# or
uv tool upgrade remove-ai-watermarks

Install from repository

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.

Note: The base install covers visible watermark removal and metadata stripping. For invisible watermark removal (SynthID etc.), install GPU dependencies:

pip install -e ".[gpu]"   # or: uv pip install -e ".[gpu]"

Invisible watermark removal

Invisible removal uses diffusion models and a GPU for reasonable speed.

# On first run, the model (~2 GB) will be downloaded automatically.
# Device is auto-detected: CUDA (Linux/Windows) > MPS (macOS) > CPU.
# To force a device: --device cuda / --device mps / --device cpu

# Optional: set a HuggingFace token for gated/private models
cp .env.example .env
# Edit .env and set HF_TOKEN=hf_your_token_here

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 all watermarks from a single image (visible + invisible + metadata)
remove-ai-watermarks all image.png -o clean.png

# Process an entire directory
remove-ai-watermarks batch ./images/ --mode all

Individual commands

# Visible watermark only (Gemini / Nano Banana sparkle) — fast, offline
remove-ai-watermarks visible image.png -o clean.png

# Invisible watermark only (SynthID etc.) — requires GPU
remove-ai-watermarks invisible image.png -o clean.png --humanize 4.0

# Check / strip AI metadata (C2PA, EXIF, "Made with AI" labels)
remove-ai-watermarks metadata image.png --check
remove-ai-watermarks metadata image.png --remove

# Batch with a specific mode
remove-ai-watermarks batch ./images/ --mode visible

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)

Troubleshooting

SSL certificate error (CERTIFICATE_VERIFY_FAILED):

# Install certifi (the tool auto-detects it)
pip install certifi

# macOS only: run the Python certificate installer
/Applications/Python\ 3.*/Install\ Certificates.command

First run is slow — this is expected. The tool downloads model weights (~2 GB) on first launch. Subsequent runs use cached models.

Credits

  • noai-watermark by mertizci — invisible watermark removal engine
  • GeminiWatermarkTool by Allen Kuo (MIT) — visible watermark removal algorithm
  • CtrlRegen by Liu et al. (ICLR 2025) — controllable regeneration pipeline
  • NeuralBleach (MIT) — analog humanizer technique

⚠️ Disclaimer

This tool is provided for educational and research purposes only.

Removing AI watermarks to misrepresent AI-generated content as human-created may violate applicable laws, including the U.S. Digital Millennium Copyright Act (DMCA) and the COPIED Act. Users are solely responsible for ensuring their use complies with all applicable laws and platform terms of service.

The authors do not condone the use of this tool for deception, fraud, or any activity that violates applicable laws or regulations.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

remove_ai_watermarks-0.3.4.tar.gz (33.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

remove_ai_watermarks-0.3.4-py3-none-any.whl (70.2 kB view details)

Uploaded Python 3

File details

Details for the file remove_ai_watermarks-0.3.4.tar.gz.

File metadata

  • Download URL: remove_ai_watermarks-0.3.4.tar.gz
  • Upload date:
  • Size: 33.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for remove_ai_watermarks-0.3.4.tar.gz
Algorithm Hash digest
SHA256 79b554c7e7d984957fb2cdef6ea1ad3445fdec74b5d62944fd53ddbf02cec0f1
MD5 dbd7c3fb65dfa9d4f340c96ae273da8c
BLAKE2b-256 19bff9dd7ee1c4f9d96dd2e81443a333f577940bf9a10cf9489c955d2cf3f8ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for remove_ai_watermarks-0.3.4.tar.gz:

Publisher: publish.yml on wiltodelta/remove-ai-watermarks

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file remove_ai_watermarks-0.3.4-py3-none-any.whl.

File metadata

File hashes

Hashes for remove_ai_watermarks-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 41ad93727ba03473bcef95253aba9b36179c86c52cea0da8f367f306f445c43c
MD5 69c0f97a5ce9fbdd303adcf62e096d8c
BLAKE2b-256 4c072a948f065ea52c30150d3fb593fc83b6ab5bc17f7405045447a518207067

See more details on using hashes here.

Provenance

The following attestation bundles were made for remove_ai_watermarks-0.3.4-py3-none-any.whl:

Publisher: publish.yml on wiltodelta/remove-ai-watermarks

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page