A fast CLI tool to remove watermarks from Google Gemini-generated images using LaMa inpainting. Runs entirely offline — your images never leave your machine.
Ported from Gemini Watermark Remover, a Chrome extension that does the same thing in the browser via ONNX Runtime Web. This is a standalone Rust reimplementation of the same pipeline for use from the command line.
# Build
cargo build --release
# Download the AI model (~208 MB, one-time)
./target/release/gemini-dewatermark --download-model
# Remove watermark
./target/release/gemini-dewatermark photo.png
# -> photo_clean.pngRequires Rust 1.70+.
cd gemini-dewatermark
cargo install --path .The binary lands in ~/.cargo/bin/gemini-dewatermark.
The tool needs the lama_fp32.onnx model file (~208 MB). On first run without a model, it tells you exactly what to do:
Error: Model file not found.
Searched:
./lama_fp32.onnx
src/assets/lama_fp32.onnx
~/Library/Application Support/gemini-dewatermark/lama_fp32.onnx
Run with --download-model to download it (~208 MB):
gemini-dewatermark --download-model
The model will be saved to:
~/Library/Application Support/gemini-dewatermark/lama_fp32.onnx
Or use --model to specify a path manually.
--download-model fetches it from Hugging Face and stores it in your platform's data directory:
| Platform | Location |
|---|---|
| macOS | ~/Library/Application Support/gemini-dewatermark/ |
| Linux | ~/.local/share/gemini-dewatermark/ |
| Windows | C:\Users\<you>\AppData\Roaming\gemini-dewatermark\ |
You can also place lama_fp32.onnx in the current directory or pass --model /path/to/lama_fp32.onnx.
# Basic — output defaults to <name>_clean.png
gemini-dewatermark input.png
# Explicit output path
gemini-dewatermark input.png -o clean.png
# Custom model location
gemini-dewatermark input.png --model ~/models/lama_fp32.onnx
# Adjust watermark region (default: 15% from bottom-right corner)
gemini-dewatermark input.png --height-ratio 0.2 --width-ratio 0.2
# Watermark in a different corner
gemini-dewatermark input.png --position top-rightUsage: gemini-dewatermark [OPTIONS] [INPUT]
Arguments:
[INPUT] Input image path
Options:
-o, --output <OUTPUT> Output image path [default: <input>_clean.png]
-m, --model <MODEL> Path to lama_fp32.onnx model file
--download-model Download the LaMa model to the data directory
--height-ratio <RATIO> Watermark height ratio [default: 0.15]
--width-ratio <RATIO> Watermark width ratio [default: 0.15]
--extended-ratio <RATIO> Extended region ratio for blending [default: 0.16]
--position <POSITION> bottom-right, bottom-left, top-right, top-left [default: bottom-right]
-h, --help Print help
- Load the input image (PNG, JPEG, WebP, etc.)
- Resize to 512x512 for the model
- Build a binary mask over the watermark region (bottom-right corner by default)
- Run LaMa inpainting via ONNX Runtime to fill in the masked area
- Composite — crop the inpainted region, scale it back to original resolution using Lanczos resampling, and overlay it onto the original image so only the watermark area is touched
The rest of the image stays pixel-identical.
- Gemini Watermark Remover — the original Chrome extension this was ported from
- LaMa — Resolution-robust Large Mask Inpainting with Fourier Convolutions
- ONNX Runtime (via
ort) — cross-platform ML inference - Carve/LaMa-ONNX — ONNX model weights on Hugging Face
Apache License 2.0 — same as the upstream project.