Gemini Watermark Tool — Gemini / Veo 可见水印去除工具(反向 Alpha 混合)
GeminiWatermarkTool 是 Allen Kuo(allenk)开源的便携式去水印工具,使用数学确定的「反向 Alpha 混合」算法重建被 Gemini 可见水印覆盖的像素,而非依赖生成式重绘,从而保留文字与细节。支持 Gemini 3.5 新水印档位并自动回退到旧档位(v0.3.1)、免费档半尺寸水印(v0.3.2),提供 GUI + CLI、三阶段 NCC 水印检测、批量处理、软件修复(NS/TELEA/Soft)与基于 FDnCNN 的 AI 去噪,并已扩展到 Veo / Gemini 3.5 视频水印去除(v0.6.1)。项目采用 MIT 许可证,跨 Windows / Linux / macOS / Android,且可通过 Claude Code Skill 与 MCP Server 接入 AI Agent 工作流。
社区作者 · zZz
它解决什么问题
项目定位
Gemini Watermark Tool 用于从图片中去除 Gemini 可见水印,核心是数学精确的反向 Alpha 混合算法,官方描述的设计理念为「small, standalone, fast, and reliable」。与大量完全依赖生成式 inpainting 的工具不同,本项目强调确定性重建 + 轻量 AI 辅助清理的组合。
关键能力
- 快速、离线:单个可执行文件,无外部服务或运行时依赖
- 独立便携:体积小,易部署
- GUI + CLI:拖拽式桌面流程或命令行自动化
- 确定性水印重建:专为 Gemini 水印叠加设计的反向 Alpha 混合算法
- AI 辅助清理:可选的 GPU 加速 FDnCNN 去噪(NCNN + Vulkan)处理残留伪影
- 智能检测:三阶段 NCC 检测带置信度评分,自动跳过无水印图片
- 批量处理:整目录处理,带预览与进度跟踪
- 跨平台:Windows / Linux / macOS / Android(CLI)
- 面向 AI Agent:Claude Code Skill + MCP Server
配图 1 为 Gemini 3.5 Preview 效果示意(artworks/gemini_35_preview.png)。
Gemini 3.5 档位支持(新增)
自 Gemini 3.5 起,Google 更改了水印位置并更新了 alpha 图。工具默认使用新档位,并提供一键 Legacy 开关,无需命令行参数或重新标定。
| 项目 | Gemini 3.5+(默认) | Legacy(pre-Gemini 3.5) | | --- | --- | --- | | Profile | V2 | V1 | | 小 logo | 36×36 | 48×48 | | 大 logo | 96×96 | 96×96 | | 边距 | 位移(按宽高比标定) | 原始 | | GUI | 「Auto Detect」/「Small」/「Large」单选 | 勾选「Legacy (pre-Gemini 3.5)」 | | CLI | 默认 | 传入 --legacy |
两个档位使用同一套确定性反向 Alpha 混合流程,切换档位只改变 alpha 图与位置公式,不改变数学方法。
自动 Legacy 回退(v0.3.1,仅 CLI)
当当前档位检测器返回 skipped(置信度低于阈值)时,CLI 会自动用 legacy 档位再跑一次同一张图,然后报告最终结果:
| 调用方式 | 第一次尝试 | 回退 | 说明 | | --- | --- | --- | --- | | GeminiWatermarkTool image.png | V2(当前) | V2 skip 时回退 V1 | v0.3.1 新默认 | | GeminiWatermarkTool --legacy image.png | 仅 V1 | — | 固定 legacy,不回退 | | GeminiWatermarkTool --no-legacy image.png | 仅 V2 | — | 等同 v0.
3.0 默认 | | GeminiWatermarkTool --legacy --no-legacy … | — | — | 参数冲突,退出码 2 |
安全性约定不变:每次档位尝试仍受置信度阈值约束,非 Gemini 图片在 V2 与 V1 上都会被跳过而不被修改。GUI 无自动回退,Legacy 复选框为显式操作。
退出码(v0.3.1)
| 码 | 含义 | | --- | --- | | 0 | 文件已处理(或批处理目录无错误完成) | | 1 | 单文件调用被跳过——所有尝试档位均未检测到水印 | | 2 | 真实失败——参数错误、输入缺失、IO/写入错误 |
批处理目录模式(-i somedir -o somedir)保持宽松语义:除非真正失败否则退出 0,因为扫描文件夹时部分跳过是正常的。
Windows shell 链式示例:
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 视频水印去除 v0.6.1
同一套反向 Alpha 混合引擎扩展到视频:直接 mp4-to-mp4,保留音频,数学确定。
支持范围:
- Gemini 3.5 菱形水印(默认,无需参数),按文件自动检测:1080p(1920×1080 横屏、1080×1920 竖屏,端到端验证)、720p(1280×720 横屏、720×1280 竖屏,含标准 48×48 与紧凑 44×44 菱形变体)
- Legacy「Veo」文字水印(--legacy),仍支持 pre-Gemini-3.5 输出
- 音频直通:原始音频不重编码
- AI 去噪:GPU 加速 FDnCNN 清理(Vulkan,自动 CPU 回退)
- 跨平台二进制:Windows x64、Linux x64、macOS Universal(Intel + Apple Silicon)
v0.6.1 算法要点:多帧检测探针(自动检测抽样 12 帧,避免片头淡入/片头卡造成误 SKIP);基于二分反馈的逐帧自适应 alpha(每帧最多 5 轮,按残留上调、按过度减除下调);逐镜头种子 + 逐帧变化上限(±0.05,防止单帧指标噪声造成可见闪烁);tick 精确的转码时序(输出帧数、时长、FPS 元数据与输入完全一致,修复此前静默丢尾帧 1–3 帧的问题);--variant 720p-1 / --variant 720p-2 逃生开关;--sigma 调参(动漫/插画用 15,默认 AI 去噪过强时用 25)。
# Default — Gemini 3.5 diamond removal (1080p + 720p auto-detected)
GeminiWatermarkTool-Video video.mp4
# Pre-Gemini-3.5 video with "Veo" text watermark
GeminiWatermarkTool-Video --legacy old_veo_video.mp4
# Anime / illustration content (lighter AI denoise)
GeminiWatermarkTool-Video --sigma 15 video.mp4作者给出的坦诚说明:前景运动极强、或前景物体与水印区域重叠的内容,仍可能在少数帧留下少量残留;此时可用手动流程(ffmpeg 分解 → GUI 手修问题帧 → ffmpeg 重组)补齐。Veo 功能目前通过独立的 VeoWatermarkRemover demo 仓库分发,待流程在所有已观察内容类别上稳定后,将合并进 GeminiWatermarkTool 作为同时支持图片与视频的统一版本。
桌面 GUI
配图 2 为 GUI 演示(artworks/gui_demo.png)。GUI 支持单图编辑(实时预览)与批量处理(智能水印检测)。
单图编辑:
- 拖放或打开支持的图片
- 自动检测水印尺寸(48×48 / 96×96)或手动选择
- 自定义水印模式:交互式绘制搜索区域,8 点锚点缩放,WASD 微调位置
- 多尺度引导检测(Snap Engine):由粗到细的 NCC 模板匹配,在绘制区域内自动锁定精确水印位置,支持 16–320px 可变尺寸,可调 Min Size 与 Max Size 滑块(Min Size 默认 16px,覆盖 Gemini 预览档约 28px 水印)
- 实时前后对比(按 V)
- 一键处理(X)与还原(Z)
配图 4 为 GUI 单图处理(artworks/gui_single.gif)。
软件修复清理(v0.2.3)
反向 Alpha 混合在数学上精确,但前提是图片在水印叠加后未被缩放、重压缩或再处理。现实中许多图片经过后处理,破坏了像素级精确数学,去水印后会留下淡淡残留。软件修复在反向混合之后增加一次轻量清理:使用从水印自身 alpha 通道派生的梯度加权蒙版,只针对残留像素,不动其余图像。
| 方法 | 说明 | 适用 | | --- | --- | --- | | NS | 基于 Navier-Stokes 的 inpainting,将周围像素流扩散进受损区域 | 通用清理,结果平滑 | | TELEA | 快速行进法,按距离加权从边界像素向内填充 | 快速处理,适合小残留 | | Soft Inpaint | 梯度加权高斯混合,以水印 alpha 作为软蒙版加权混合 | 保留摄影内容的细腻纹理 |
清理控件在 Custom 模式下自动出现在 Detected Info 面板,可调方法、强度(0–100%)与 inpaint 半径(1–25 px)。配图 5 为软件修复示意(artworks/gui_inpaint_sw.gif)。
AI 去噪 — FDnCNN 神经网络(v0.2.5)
AI 去噪使用 GPU 加速神经网络 FDnCNN 清理传统 inpainting 难以处理的残留,尤其是缩放图上反向 Alpha 混合后留下的微弱星芒边缘与角落伪影。与需要二值蒙版的 NS/TELEA 不同,AI 去噪会检查每个点周围 41×41 像素邻域,从训练数据
— 本文由 AI 根据公开来源辅助整理,命令、版本与许可证请在使用前到原始页面复核。
安装 / 开始使用
▶️ 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:
📖 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:
✨ 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+ (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
- Preserve the original copyright notice
- Include the full MIT license text
- (Recommended) Provide attribution with a link back to this repository
- 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




