Expand description
Remove visible Gemini AI watermarks via reverse alpha blending.
Gemini AI overlays a semi-transparent star/sparkle logo on generated images. This crate reverses the alpha-blending equation to recover the original pixels, using calibrated 48x48 and 96x96 alpha masks embedded in the binary.
§Quick Start
use gemini_watermark_removal::{WatermarkEngine, ProcessOptions};
let engine = WatermarkEngine::new().expect("failed to init engine");
let mut img = image::open("photo.jpg").unwrap().to_rgb8();
engine.remove(&mut img, None);
img.save("cleaned.jpg").unwrap();§Detection
Before removal, a three-stage detection algorithm checks whether a watermark is present (spatial NCC, gradient NCC, variance analysis). Images without detected watermarks can be automatically skipped to protect originals.
use gemini_watermark_removal::{WatermarkEngine, ProcessOptions};
let engine = WatermarkEngine::new().expect("failed to init engine");
let img = image::open("photo.jpg").unwrap().to_rgb8();
let opts = ProcessOptions::default();
let result = engine.detect(&img, &opts);
println!("Detected: {}, confidence: {:.0}%", result.detected, result.confidence * 100.0);Re-exports§
Modules§
- blending
- Alpha blending math for watermark removal.
- detection
- Three-stage watermark detection algorithm.
- error
- Error types for the gemini-watermark-removal crate.
Structs§
- Process
Options - Options controlling watermark processing behavior.
- Process
Result - Result of processing a single image file.
- Watermark
Engine - The watermark engine holding pre-computed alpha maps.
Enums§
- Watermark
Size - Watermark size classification.
Functions§
- default_
output_ path - Generate a default output path from an input path.
- is_
supported_ image - Check if a file has a supported image extension.
- save_
image - Save an RGB image with format-specific quality settings.