2 pointsby h2bomb9 hours ago1 comment
  • h2bomb9 hours ago
    I’ve been using Google's Gemini for image generation, but the watermarks are often a hurdle for clean designs.

    I built this web tool based on the Reverse Alpha Blending principle. Unlike typical "AI erasers" that use generative inpainting to fill in gaps (which often results in blurriness), this tool treats the watermark as a standard alpha-composited layer and mathematically reverses the blending formula.

    Key Technical Implementation:

    Pure Client-Side: The core engine is written in vanilla JavaScript. It uses the Canvas API to extract ImageData and processes pixels directly in the browser. No images are ever uploaded to a server.

    Deterministic Restoration: It reverses the formula: $original = (watermarked - \alpha \times 255) / (1 - \alpha)$. By using a pre-calculated Alpha Map from the Gemini logo, it achieves pixel-perfect restoration with zero AI "hallucinations".

    Auto-scaling Logic: The tool automatically detects whether the image uses the 48px or 96px watermark variant based on the source dimensions (1024px threshold), ensuring the correct $\alpha$ mask is applied.

    Optimization: It uses Float32Array for the alpha map and implements threshold clamping (e.g., ignoring $\alpha < 0.002$) to avoid floating-point noise and division-by-zero errors.

    I'm standing on the shoulders of giants here—special thanks to Allen Kuo for the original algorithm research and CLI tool [0]. I wanted to make this technique accessible to non-technical users through a frictionless web interface.

    Web Version: https://re.easynote.cc Original Research: https://github.com/allenk/GeminiWatermarkTool