MCPcopy Create free account
hub / github.com/allenk/GeminiWatermarkTool

github.com/allenk/GeminiWatermarkTool @v0.3.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.1 ↗ · + Follow
300 symbols 574 edges 38 files 75 documented · 25% updated 47d agov0.3.1 · 2026-05-22★ 2,7997 open issues

Browse by type

Functions 250 Types & classes 50
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Gemini Watermark Tool

C++20 Platform AI Denoise MCP License: MIT GitHub Stars

🆕 Gemini 3.5 watermark profile supported, with automatic legacy fallback (v0.3.1) — the CLI tries the current Gemini 3.5+ profile first; if detection skips, it automatically retries with the legacy (pre-3.5) profile. Disable with --no-legacy, or pin legacy directly with --legacy. Details below.

📢 Now available: Veo Video Watermark Remover — remove Google Veo "Veo" text watermarks from videos, same reverse alpha blending engine. Demo build (Win x64).

▶️ Watch: GeminiWatermarkTool — Quick Start & Feature Overview

📌 Original Author Notice (Reverse Alpha Blending)

I am the original author of GeminiWatermarkTool and the reverse alpha-blending restoration method used to remove the visible "Gemini" watermark while preserving image detail (Allen Kuo / allenk).

This project achieves high-precision restoration by using my calibrated 48×48 and 96×96 Reverse-Alpha Masks to invert the blending equation. Since I published this work and these assets, many derivative tools (desktop apps, websites, browser extensions, etc.) have appeared using the same approach and/or directly reusing the masks produced by this project — because the method is deterministic and highly effective.

MIT License reminder
This project is released under the MIT License. Commercial use and ports are allowed.
However, if you redistribute any substantial portion of this project (including code or mask assets), you must: - Preserve the original copyright notice - Include the full MIT license text - (Recommended) Provide attribution with a link back to this repository

📖 For the full technical write-up (including how the Reverse-Alpha Masks were derived and calibrated), see:
Removing Gemini AI Watermarks: A Deep Dive into Reverse Alpha Blending
https://allenkuo.medium.com/removing-gemini-ai-watermarks-a-deep-dive-into-reverse-alpha-blending-bbbd83af2a3f

Gemini Watermark Tool removes Gemini visible watermarks from images using a mathematically accurate reverse alpha blending algorithm.
Unlike many tools that rely entirely on generative inpainting, this project focuses on deterministic reconstruction combined with lightweight AI-assisted cleanup.

The design philosophy is simple:
small, standalone, fast, and reliable.

The entire toolkit is distributed as a portable executable with zero runtime dependencies, making it easy to install, automate, and integrate into scripts or pipelines without complex setup.

Key capabilities include:

  • Fast & offline: single executable, no external services or dependencies
  • Standalone & portable: small footprint, easy to deploy and use anywhere
  • GUI + CLI: drag-and-drop desktop workflow or command-line automation
  • Deterministic watermark reconstruction: reverse alpha blending algorithm designed specifically for Gemini watermark overlays
  • AI-assisted cleanup: optional GPU-accelerated FDnCNN denoise (NCNN + Vulkan) for residual artifacts
  • Smart detection: three-stage NCC detection with confidence scoring to automatically skip non-watermarked images
  • Batch processing: process entire directories with preview and progress tracking
  • Cross-platform: Windows / Linux / macOS / Android (CLI)
  • AI Agent ready: Claude Code Skill + MCP Server for automation and agent workflows

✨ Gemini 3.5 Support — New

GeminiWatermarkTool now supports the new Gemini 3.5 watermark layout out of the box. Starting with Gemini 3.5, Google shifted the watermark position and updated its alpha map relative to legacy Gemini outputs. The tool targets the new profile by default and ships a one-click Legacy toggle for pre-3.5 outputs — no command-line flags or re-calibration needed.

Gemini 3.5 Preview

Gemini 3.5+ (default) Legacy (pre-Gemini 3.5)
Profile V2 V1
Small logo 36×36 48×48
Large logo 96×96 96×96
Margin shifted (per-aspect calibrated) original
GUI "Auto Detect" / "Small" / "Large" radios tick "Legacy (pre-Gemini 3.5)" checkbox
CLI default pass --legacy

Both profiles use the same deterministic reverse alpha blending pipeline — switching profiles only changes the alpha map and position formula, not the math.

Automatic Legacy Fallback (v0.3.1, CLI only)

The CLI default now handles mixed Gemini-3.5+ and pre-3.5 inputs without the user having to script the retry. When the current-profile detector returns skipped (confidence below threshold), the CLI automatically runs the same image through the legacy profile before reporting the final outcome. Behaviour matrix:

Invocation First attempt Fallback Notes
GeminiWatermarkTool image.png V2 (current) V1 if V2 skips new v0.3.1 default
GeminiWatermarkTool --legacy image.png V1 only pin legacy, no fallback
GeminiWatermarkTool --no-legacy image.png V2 only matches v0.3.0 default
GeminiWatermarkTool --legacy --no-legacy … conflict, exits 2

The safety contract is unchanged: each profile attempt is still gated by the confidence threshold, so non-Gemini images skip on both V2 and V1 and remain untouched. The GUI is unchanged — its Legacy checkbox is explicit, no automatic fallback.

Exit Codes (v0.3.1)

The CLI now returns distinct exit codes so scripts can chain retries without inspecting stdout or checking for an output file:

Code Meaning
0 File processed (or batch directory completed with no errors)
1 Single-file invocation skipped — no watermark detected on any tried profile
2 Real failure — bad arguments, missing input, IO/write error

Batch directory mode (-i somedir -o somedir) keeps lenient semantics: exit 0 unless something actually fails, since partial skips are normal when scanning a folder.

Example Windows shell chain:

GeminiWatermarkTool.exe -i image.png -o clean.png
if %ERRORLEVEL% equ 1 (
    rem auto-fallback tried both V2 and V1 and skipped; user may want --force
    GeminiWatermarkTool.exe -i image.png -o clean.png --force
)

🎬 Veo Video Watermark Removal — Demo Available

NEW: GeminiWatermarkTool now supports removing Google Veo video watermarks. The same reverse alpha blending engine, now for video — direct mp4-to-mp4, with audio preserved.

A standalone demo build (Windows x64) is available for testing:

VeoWatermarkRemover — Download Demo

  • Drag & drop your Veo .mp4 file onto the exe — done
  • 36 MB standalone, zero dependencies
  • 720p ~50 fps, 1080p ~18 fps
  • AI denoise + audio passthrough included

Cross-platform support and GUI integration are coming soon. This Veo feature will be merged into GeminiWatermarkTool when stable.

🖥️ GUI Application — Major Update

GeminiWatermarkTool now comes with a full graphical desktop application. No command line needed — just open, drag & drop, and process. Supports single-image editing with real-time preview, and batch processing with smart watermark detection.

The desktop GUI provides an interactive workflow for both single-image and batch operations.

GUI Demo

AI Agent - Integration (New in v0.2.5)

GeminiWatermarkTool can now be integrated into AI-agent workflows via MCP server and Claude Code skills. This enables automated watermark processing inside agent-based pipelines.

gwt-integrations — Claude Code Skill + MCP Server for GeminiWatermarkTool

Enable AI coding agents (Claude Code, Cursor, Windsurf, etc.) to use GeminiWatermarkTool directly:

Component Description
Claude Code Skill Teaches AI agents GWT's full CLI syntax, region/snap/denoise options, and best practices — agents can remove watermarks from images without manual guidance
MCP Server Exposes GWT as 4 tools via Model Context Protocolremove_watermark, detect_watermark, batch_process, get_tool_info — any MCP-compatible client can call them
install.py Cross-platform installer (stdlib only) — auto-detects GWT binary, configures Claude Code skill and MCP server in one command

AI MCP Skill

Single Image Editing

GUI Single Image

  • Drag & drop or open any supported image
  • Auto-detect watermark size (48×48 / 96×96) or select manually
  • Custom watermark mode: draw a search region interactively, resize with 8-point anchors, fine-tune position with WASD keys
  • Multi-scale guided detection (Snap Engine): coarse-to-fine NCC template matching auto-locks to the exact watermark position within your drawn region — supports variable sizes from 16–320px with adjustable Min Size and Max Size sliders (Min Size default 16px covers Gemini preview-tier watermarks ~28px)
  • Real-time before/after comparison (press V)
  • One-key processing (X) and revert (Z)
  • Zoom, pan (Space/Alt + drag, mouse wheel), and fit-to-window

Software Inpainting Cleanup (New in v0.2.3)

Software Inpainting

Reverse alpha blending is mathematically exact — but only when the image hasn't been resized, recompressed, or processed after watermarking. In practice, many images go through post-processing that breaks the pixel-perfect math, leaving faint residual artifacts after removal.

Software Inpainting addresses this by applying a lightweight cleanup pass after the reverse blending step. It uses gradient-weighted masks derived from the watermark's own alpha channel to target only the residual pixels, leaving the rest of the image untouched.

Three built-in methods are available:

Method Description Best for
NS Navier-Stokes based inpainting — propagates surrounding pixel flow into the damaged region General-purpose cleanup with smooth results
TELEA Fast marching method — fills inward from boundary pixels based on distance weighting Quick processing, good for small residuals
Soft Inpaint Gradient-weighted Gaussian blend — uses the watermark alpha as a soft mask for weighted blending Preserving fine texture in photographic content

The cleanup controls appear automatically in Custom mode under the Detected Info panel. You can adjust the method, strength (0–100%), and inpaint radius (1–25 px) to fine-tune the result.

AI Denoise — FDnCNN Neural Network (New in v0.2.5)

AI Denoise

AI Denoise uses a GPU-accelerated neural network (FDnCNN) to clean up watermark residuals that conventional inpainting methods struggle with — particularly the faint sparkle edges and corner artifacts left after reverse alpha blending on resized images.

Unlike NS/TELEA which require a binary mask to know which pixels are damaged, AI Denoise examines a 41×41 pixel neighborhood around each point and learns from training data what "normal" image content looks like. Combined with gradient-masked blending from the alpha map, it repairs only the artifact pixels while preserving clean background detail.

Parameter Range Default Description
Strength 0–300% 120% Controls mask coverage — values above 100% expand repair to weaker gradient edges
Sigma 1–150 50 Noise level estimation — higher values denoise more aggressively

Technical details: - Model: FDnCNN Color, 20-layer Conv+ReLU, FP16 (~1.3 MB embedded in executable) - Inference: NCNN with Vulkan GPU acceleration, automatic CPU fallback - Pipeline: gradient mask from alpha map → NCNN inference on padded ROI → per-pixel masked blend - Performance: < 5 ms per region on modern GPUs, ~20 ms on CPU

AI Denoise is the recommended default when available. The GPU device name is displayed below the controls. If GPU initialization fails, the tool automatically falls back to NS inpainting.

Batch Processing

GUI Batch Processing

  • Drag & drop multiple files or an entire folder to enter batch mode
  • Thumbnail atlas preview with filename labels and status overlays (OK / SKIP / FAIL)
  • Detection threshold slider (0–100%, 5% steps, 25% recommended) — automatically skip images without watermarks
  • Confirmation dialog before overwriting originals
  • Non-blocking processing with progress bar and scrollable result log
  • Thumbnails refresh after completion to show processed results

Keyboard Shortcuts

Key Action
X Process image
V Compare with original
Z Revert to original
C (hold) Hide overlay
W A S D Move custom watermark region
Space / Alt Pan (hold + drag)
Sc

Core symbols most depended-on inside this repo

Shape

Method 194
Function 56
Class 38
Enum 12

Languages

C++100%

Modules by API surface

src/gui/app/app_state.hpp36 symbols
src/gui/app/app_controller.cpp32 symbols
src/gui/widgets/main_window.cpp31 symbols
src/gui/backend/d3d11_backend.cpp21 symbols
src/gui/backend/vulkan_backend.cpp17 symbols
src/gui/backend/opengl_backend.cpp17 symbols
src/core/watermark_engine.cpp17 symbols
src/cli/cli_app.cpp16 symbols
src/gui/backend/render_backend.hpp15 symbols
src/core/ai_denoise.cpp15 symbols
src/gui/widgets/image_preview.cpp13 symbols
src/core/watermark_engine.hpp10 symbols

For agents

$ claude mcp add GeminiWatermarkTool \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page