Skip to content

dearabhin/gemini-watermark-remover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Gemini Watermark Remover

Live Demo Stack License

A high-performance, 100% client-side tool for removing watermarks from images generated by Google Gemini AI. Built with pure Vanilla JavaScript, it uses a mathematically precise Reverse Alpha Blending algorithm to restore pixels with zero quality loss.

🔗 Live Website: remove-watermark.mlaas.in


🚀 Features

  • 100% Client-Side Processing: No servers involved. Images are processed locally in your browser for maximum privacy.
  • Lossless Restoration: Uses exact mathematical inversion rather than AI inpainting, ensuring original pixel quality is preserved.
  • Zero Dependencies: Built with native ES6 Modules and Tailwind CSS (via CDN) — no complex build steps required.
  • Auto-Detection: Automatically detects watermark size (48px or 96px) based on image resolution.
  • Mobile Responsive: Fully optimized UI for desktop and mobile devices.

🧠 How It Works (The Algorithm)

Gemini adds watermarks using a standard Alpha Compositing (blending) technique. This tool simply reverses that math.

1. The Watermark Formula

When Gemini generates an image, it applies the watermark logo using this formula:

$$Pixel_{final} = (\alpha \times Pixel_{logo}) + (1 - \alpha) \times Pixel_{original}$$

Where:

  • α (Alpha): The transparency level of the watermark pixel (0.0 to 1.0).
  • Pixel_logo: The color of the watermark (Pure White / 255).
  • Pixel_original: The original color we want to recover.

2. The Solution (Reverse Engineering)

Since we know the Pixel_final (from your uploaded image), the Pixel_logo (White), and the α map (extracted from reference images), we can solve for Pixel_original:

$$Pixel_{original} = \frac{Pixel_{final} - (\alpha \times Pixel_{logo})}{1 - \alpha}$$

3. Alpha Map Extraction

The tool loads two reference "background" images (bg_48.png and bg_96.png) which contain the isolated watermark alpha values. It reads these values to construct a precise Float32Array map of transparency levels, allowing for pixel-perfect subtraction.


📂 Project Structure

This project uses a simple, modern static site structure using ES6 Modules.

gemini-remover/
├── assets/
│   ├── bg_48.png       # Reference alpha map for small images
│   ├── bg_96.png       # Reference alpha map for large images (>1024px)
│   └── og-image.jpg    # Social media preview image
├── js/
│   ├── alphaMap.js     # Logic to calculate transparency values
│   ├── blendModes.js   # The math implementation (Reverse Formula)
│   ├── engine.js       # Main controller (Asset loading & processing)
│   └── app.js          # UI interaction & DOM manipulation
└── index.html          # Main application file

🛠️ Tech Stack

  • HTML5: Semantic markup.
  • CSS: Tailwind CSS (loaded via CDN for simplicity).
  • JavaScript: Vanilla ES6+ (No frameworks like React or Vue).
  • Libraries:
    • Iconify (for icons).
    • (Optional) JSZip (if bulk download is implemented).

⚡ Running Locally

Since this project uses ES6 Modules (import/export), you cannot simply open index.html in a file explorer (CORS security rules will block the script loading). You must serve it via a local server.

Option 1: VS Code (Recommended)

  1. Install the "Live Server" extension.
  2. Right-click index.html.
  3. Select "Open with Live Server".

Option 2: Python

If you have Python installed, open a terminal in the project folder and run:

# Python 3
python -m http.server 8000

⚠️ Disclaimer

This tool is for educational and personal use only.

  • It only removes visible watermarks; it does not remove invisible SynthID watermarks embedded by Google.
  • Please respect Google's Terms of Service and Intellectual Property rights.

🤝 Credits

About

A high-performance, 100% client-side tool for removing watermarks from images generated by Google Gemini AI. Built with pure Vanilla JavaScript, it uses a mathematically precise Reverse Alpha Blending algorithm to restore pixels with zero quality loss.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors