gemini_watermark_cleaner/README.md

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: esbuild for 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:

🚀 Usage

Development

  1. Clone the repository:
    git clone http://git.unissense.tech/mula/gemini_watermark_cleaner.git
    
  2. Install dependencies:
    pnpm install
    
  3. Start development mode (rebuilds on changes):
    pnpm dev
    
  4. Start a local preview server:
    pnpm serve
    
  5. Build for production:
    pnpm build
    

Docker Deployment

  1. Build and run the container:
    docker-compose up -d --build
    
  2. 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.

📄 License

MIT License