3.9 KiB
Gemini & NotebookLM Watermark Cleaner
A privacy-first, browser-based tool for removing watermarks from Gemini and NotebookLM generated content (Images & PDFs). Built with vanilla JavaScript, featuring mathematical precision for lossless restoration and robust fallback cloning for complex document formats.
✨ Features
- Multi-Format Support: Handles standard Gemini Images (
.jpg,.png,.webp) and NotebookLM documents (.pdf). - Lossless Restoration: Uses Reverse Alpha Blending for standard Gemini images to perfectly restore original pixels without blurring.
- Smart Cloning: Applies intelligent Simple Clone (patching) for NotebookLM headers/footers and PDF slides where alpha maps don't apply.
- Privacy-First: 100% client-side processing. No files are ever uploaded to any server.
- Batch Processing: Process multiple files at once and download them as a ZIP archive.
- Modern UI: Dark/Light mode support with a clean, responsive interface.
- PDF Preview: Real-time progress tracking and preview for PDF file cleaning.
🛠️ Technology Stack
- Core Logic: Vanilla JavaScript (ES Modules)
- PDF Processing:
pdfjs-dist(Parsing) &jspdf(Re-generation) - UI Styling: Tailwind CSS (CDN)
- Packaging:
esbuildfor bundling
🧩 How It Works
This tool employs two distinct strategies depending on the content type:
1. Reverse Alpha Blending (for Gemini Images)
Gemini applies watermarks using a standard alpha compositing formula:
Pixel_{watermarked} = \alpha \cdot Pixel_{logo} + (1 - \alpha) \cdot Pixel_{original}
We reverse this to recover the original pixel:
Pixel_{original} = \frac{Pixel_{watermarked} - \alpha \cdot Pixel_{logo}}{1 - \alpha}
By using pre-calibrated Alpha Maps (48px/96px), we can mathematically restore the original pixel values with near-zero loss.
2. Smart Cloning (for NotebookLM & PDF)
For NotebookLM's strip-like watermarks or PDF slides where exact alpha maps vary, the tool uses a Simple Clone technique. It identifies the watermark region and intelligently "clones" a patch of pixels from the immediate neighborhood (e.g., just above the watermark) to cover it, blending the edges for a seamless look.
🔗 Attribution & References
This project is built upon the excellent work of the open-source community. Special thanks to:
-
Original Project: gemini-watermark-remover by journey-ad.
- Base architecture, alpha map logic, and core "Reverse Alpha Blending" implementation.
-
Algorithm Origin: Gemini Watermark Tool by Allen Kuo.
- Original discovery of the math and watermark masks.
🚀 Usage
Development
- Clone the repository:
git clone http://git.unissense.tech/mula/gemini_watermark_cleaner.git - Install dependencies:
pnpm install - Start development mode (rebuilds on changes):
pnpm dev - Start a local preview server:
pnpm serve - Build for production:
pnpm build
Docker Deployment
- Build and run the container:
docker-compose up -d --build - The application will be available at
http://localhost:3000(or the port specified in.env).
Browser
Simply open the dist/index.html (after building) or the deployed site. Drag and drop your files.
- Images: Instant preview and cleaning.
- PDFs: Shows progress per page, then displays the cleaned first page.