Skip to main content

Crate gemini_watermark_removal

Crate gemini_watermark_removal 

Source
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§

pub use error::Error;
pub use error::Result;

Modules§

blending
Alpha blending math for watermark removal.
detection
Three-stage watermark detection algorithm.
error
Error types for the gemini-watermark-removal crate.

Structs§

ProcessOptions
Options controlling watermark processing behavior.
ProcessResult
Result of processing a single image file.
WatermarkEngine
The watermark engine holding pre-computed alpha maps.

Enums§

WatermarkSize
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.