gemini_watermark_cleaner/README.md

92 lines
3.9 KiB
Markdown
Raw Permalink Normal View History

2025-12-19 09:10:36 +00:00
[中文文档](README_zh.md)
2026-02-03 05:13:33 +00:00
# Gemini & NotebookLM Watermark Cleaner
2025-12-19 09:10:36 +00:00
2026-02-03 05:13:33 +00:00
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.
2025-12-19 09:10:36 +00:00
<p align="center">
<img src="https://count.getloli.com/@gemini-watermark-remover?name=gemini-watermark-remover&theme=minecraft&padding=7&offset=0&align=top&scale=1&pixelated=1&darkmode=auto" width="400">
</p>
2026-02-03 05:13:33 +00:00
## ✨ Features
2025-12-19 09:10:36 +00:00
2026-02-03 05:13:33 +00:00
- **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.
2025-12-19 09:10:36 +00:00
2026-02-03 05:13:33 +00:00
## 🛠️ Technology Stack
2025-12-19 09:10:36 +00:00
2026-02-03 05:13:33 +00:00
- **Core Logic**: Vanilla JavaScript (ES Modules)
- **PDF Processing**: `pdfjs-dist` (Parsing) & `jspdf` (Re-generation)
- **UI Styling**: Tailwind CSS (CDN)
- **Packaging**: `esbuild` for bundling
2025-12-20 07:30:01 +00:00
2026-02-03 05:13:33 +00:00
## 🧩 How It Works
2025-12-20 07:30:01 +00:00
2026-02-03 05:13:33 +00:00
This tool employs two distinct strategies depending on the content type:
2025-12-19 09:10:36 +00:00
2026-02-03 05:13:33 +00:00
### 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}$$
2025-12-19 09:10:36 +00:00
2026-02-03 05:13:33 +00:00
We reverse this to recover the original pixel:
$$Pixel_{original} = \frac{Pixel_{watermarked} - \alpha \cdot Pixel_{logo}}{1 - \alpha}$$
2025-12-19 09:10:36 +00:00
2026-02-03 05:13:33 +00:00
By using pre-calibrated Alpha Maps (48px/96px), we can mathematically restore the original pixel values with near-zero loss.
2025-12-19 09:10:36 +00:00
2026-02-03 05:13:33 +00:00
### 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.
2025-12-19 09:10:36 +00:00
2026-02-03 05:13:33 +00:00
## 🔗 Attribution & References
2026-02-03 05:13:33 +00:00
This project is built upon the excellent work of the open-source community. Special thanks to:
2025-12-19 09:10:36 +00:00
2026-02-03 05:13:33 +00:00
- **Original Project**: [gemini-watermark-remover](https://github.com/journey-ad/gemini-watermark-remover) by [journey-ad](https://github.com/journey-ad).
- *Base architecture, alpha map logic, and core "Reverse Alpha Blending" implementation.*
2025-12-20 06:11:23 +00:00
2026-02-03 05:13:33 +00:00
- **Algorithm Origin**: [Gemini Watermark Tool](https://github.com/allenk/GeminiWatermarkTool) by [Allen Kuo](https://github.com/allenk).
- *Original discovery of the math and watermark masks.*
2025-12-19 09:10:36 +00:00
2026-02-03 05:13:33 +00:00
## 🚀 Usage
2025-12-20 06:11:23 +00:00
2026-02-03 05:13:33 +00:00
### Development
1. Clone the repository:
```bash
git clone http://git.unissense.tech/mula/gemini_watermark_cleaner.git
```
2. Install dependencies:
```bash
pnpm install
```
3. Start development mode (rebuilds on changes):
```bash
pnpm dev
```
4. Start a local preview server:
```bash
pnpm serve
```
5. Build for production:
```bash
pnpm build
```
2025-12-20 06:11:23 +00:00
2026-02-03 05:13:33 +00:00
### Docker Deployment
1. Build and run the container:
```bash
docker-compose up -d --build
```
2. The application will be available at `http://localhost:3000` (or the port specified in `.env`).
2025-12-20 06:11:23 +00:00
2026-02-03 05:13:33 +00:00
### 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.
2025-12-20 06:11:23 +00:00
2026-02-03 05:13:33 +00:00
## 📄 License
2025-12-20 06:11:23 +00:00
2026-02-03 05:13:33 +00:00
[MIT License](./LICENSE)