
移除 Gemini AI浮水印:深度解析反向Alpha混合
本文介紹了一個開源工具,旨在自動移除Google Gemini AI生成圖像中的浮水印。文章深入探討了實現此功能的反向Alpha混合技術。
Sign up
Sign in
Sign up
Sign in

Removing Gemini AI Watermarks: A Deep Dive into Reverse Alpha Blending
--
Listen
Share
An open-source tool to cleanly remove those pesky watermarks from your AI-generated images
The Problem: Beautiful Images, Annoying Watermarks
If you’ve been using Google’s Gemini AI for image generation — whether it’s Gemini Nano, Gemini Flash, or Gemini Pro — you’ve probably noticed something: every generated image comes with a semi-transparent watermark in the bottom-right corner.
Don’t get me wrong. I understand why Google adds these watermarks. Transparency about AI-generated content is important. But there are legitimate scenarios where these watermarks become a real headache:
I found myself manually editing these watermarks out in Photoshop, one image at a time. After the tenth image, I thought: there has to be a better way.
So I built one.
Introducing Gemini Watermark Tool
Gemini Watermark Tool is a lightweight, standalone command-line utility that removes Gemini watermarks from images — accurately and efficiently.
Key Features
How to Use It
The Simplest Way: Drag & Drop
Command Line Usage
For more control, use the command line:
Watermark Size Detection
Gemini uses different watermark sizes based on image dimensions:
Image Dimensions Watermark Size Margin W ≤ 1024 or H ≤ 1024 48×48 pixels 32px W > 1024 and H > 1024 96×96 pixels 64px
The tool automatically detects which size to use, but you can override it with --force-small or --force-large if needed.
The Technical Magic: Reverse Alpha Blending
Now for the interesting part — how does this actually work?
Understanding How Gemini Adds Watermarks
Most people assume watermarks are simply “stamped” onto images. But Gemini uses something more sophisticated: alpha blending.
The formula is:
Where:
This creates that semi-transparent overlay effect you see in Gemini images.
Rebuild the Alpha Map
Here’s the clever part. This is the key point. By statistically analyzing and comparing values related to Alpha, we can reconstruct an Alpha table that is either correct or very close to it.
Reversing the Process
Now that we know α for every pixel, we can algebraically reverse the blending formula:
This is the key equation. For each pixel in the watermarked region:
The result? Mathematically accurate reconstruction of the original pixel values.
Why This Works Better Than Alternatives
Other approaches like:
Our approach doesn’t guess. It calculates the exact original values using the known watermark pattern. The only error comes from 8-bit quantization (±1 in pixel value), which is imperceptible to the human eye.
Edge Handling
You might wonder about the watermark edges, where pixels are semi-transparent. This is actually handled beautifully by the alpha map itself. Edge pixels have low alpha values (say, 0.1 or 0.2), and the reverse formula naturally accounts for this, producing smooth transitions with no visible seams.
Open Source
I’ve released this tool under the MIT License. The complete source code is available on GitHub:
🔗 https://github.com/allenk/GeminiWatermarkTool
Current Version: v0.1.2
Features:
Building from Source
Important Disclaimer
⚠️ This tool is provided for personal and educational use.
A few things to keep in mind:
What’s Next?
I’m considering a few enhancements for future versions:
If you have feature requests or find bugs, please open an issue on GitHub.
Conclusion
What started as a personal annoyance turned into an interesting technical challenge. The mathematics behind alpha blending are elegant, and reversing it produces surprisingly clean results.
If you’re tired of manually editing watermarks out of your Gemini-generated images, give this tool a try. And if you’re a developer interested in image processing, I hope the source code provides some useful insights.
Download: GitHub Releases
Source Code: github.com/allenk/GeminiWatermarkTool
If you found this useful, consider giving the repo a ⭐ on GitHub. Questions or feedback? Leave a comment below or reach out on GitHub.
Tags: #AI #Gemini #ImageProcessing #OpenSource #Tools #Programming #CPlusPlus
--
--
Written by Allen Kuo (kwyshell)
No responses yet
Help
Status
About
Careers
Press
Blog
Privacy
Rules
Terms
Text to speech
相關文章