Skip to main content

gemini_watermark_removal/
lib.rs

1//! Remove visible Gemini AI watermarks via reverse alpha blending.
2//!
3//! Gemini AI overlays a semi-transparent star/sparkle logo on generated images.
4//! This crate reverses the alpha-blending equation to recover the original pixels,
5//! using calibrated 48x48 and 96x96 alpha masks embedded in the binary.
6//!
7//! # Quick Start
8//!
9//! ```no_run
10//! use gemini_watermark_removal::{WatermarkEngine, ProcessOptions};
11//!
12//! let engine = WatermarkEngine::new().expect("failed to init engine");
13//! let mut img = image::open("photo.jpg").unwrap().to_rgb8();
14//! engine.remove(&mut img, None);
15//! img.save("cleaned.jpg").unwrap();
16//! ```
17//!
18//! # Detection
19//!
20//! Before removal, a three-stage detection algorithm checks whether a watermark
21//! is present (spatial NCC, gradient NCC, variance analysis). Images without
22//! detected watermarks can be automatically skipped to protect originals.
23//!
24//! ```no_run
25//! use gemini_watermark_removal::{WatermarkEngine, ProcessOptions};
26//!
27//! let engine = WatermarkEngine::new().expect("failed to init engine");
28//! let img = image::open("photo.jpg").unwrap().to_rgb8();
29//! let opts = ProcessOptions::default();
30//! let result = engine.detect(&img, &opts);
31//! println!("Detected: {}, confidence: {:.0}%", result.detected, result.confidence * 100.0);
32//! ```
33
34#![deny(missing_docs)]
35
36mod alpha_maps;
37pub mod blending;
38pub mod detection;
39mod engine;
40pub mod error;
41
42pub use engine::{
43    default_output_path, is_supported_image, save_image, ProcessOptions, ProcessResult,
44    WatermarkEngine, WatermarkSize,
45};
46pub use error::{Error, Result};