diff --git a/README.md b/README.md index 351ca84..6074a81 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,45 @@ # Remove-AI-Watermarks -Unified tool for removing **visible** and **invisible** AI watermarks from images. +Remove **visible** and **invisible** AI watermarks from images generated by Google Gemini (Nano Banana), ChatGPT / DALL-E, Stable Diffusion, Adobe Firefly, Midjourney, and other AI models. + +Strips SynthID, C2PA Content Credentials, EXIF/XMP "Made with AI" labels, and visible sparkle overlays — all in one command. ## Features -- **Visible watermark removal** — Gemini sparkle logo via reverse alpha blending (fast, offline, deterministic) +- **Visible watermark removal** — Gemini / Nano Banana sparkle logo via reverse alpha blending (fast, offline, deterministic) - **Invisible watermark removal** — SynthID, StableSignature, TreeRing via diffusion-based regeneration -- **AI metadata stripping** — EXIF, PNG text chunks, C2PA provenance manifests -- **Analog Humanizer** — film grain and chromatic aberration injection to bypass AI image classifiers +- **AI metadata stripping** — EXIF, PNG text chunks, C2PA provenance manifests, XMP DigitalSourceType +- **"Made with AI" label removal** — removes the metadata that triggers AI labels on Instagram, Facebook, X (Twitter) +- **Analog Humanizer** — film grain and chromatic aberration to bypass AI image classifiers - **Smart Face Protection** — automatic extraction and blending of human faces to prevent AI distortion -- **High-Res Upscaler** — prevents resolution degradation during invisible watermark removal - **Batch processing** — process entire directories - **Detection** — three-stage NCC watermark detection with confidence scoring +## Supported models + +| AI model | Visible watermark | Invisible watermark | Metadata | Our approach | +| --- | --- | --- | --- | --- | +| **Google Gemini / Nano Banana** | ✅ Sparkle logo | ✅ SynthID | ✅ C2PA + EXIF | Alpha reversal + diffusion + metadata strip | +| **OpenAI DALL-E 3 / ChatGPT** | — | — | ✅ C2PA manifest | Metadata strip | +| **Stable Diffusion (AUTOMATIC1111, ComfyUI)** | — | ✅ DWT / steganographic | ✅ PNG text chunks | Diffusion regeneration + metadata strip | +| **Adobe Firefly** | — | — | ✅ Content Credentials (C2PA) | Metadata strip | +| **Midjourney** | — | — | ✅ EXIF + XMP (prompt, model, seed) | Metadata strip | +| **StableSignature** (Meta) | — | ✅ In-model watermark | — | Diffusion regeneration | +| **TreeRing** | — | ✅ Latent space watermark | — | Diffusion regeneration | + +> Visible watermarks (logo overlays) are currently used only by Google Gemini / Nano Banana. Other services rely on invisible watermarks and/or metadata. Our diffusion-based regeneration works against any invisible watermark in pixel or frequency domain. + ## How it works -### 1. Visible watermark removal +### Removing the Gemini / Nano Banana sparkle watermark -Gemini embeds a sparkle logo using alpha blending: +Google Gemini (internally codenamed **Nano Banana**) adds a visible sparkle logo to generated images using alpha blending: ```text watermarked = α × logo + (1 − α) × original ``` -We reverse this with a known alpha map (extracted from Gemini on a pure-black background): +We reverse this with a known alpha map (extracted from Gemini / Nano Banana output on a pure-black background): ```text original = (watermarked − α × logo) / (1 − α) @@ -33,9 +49,9 @@ A three-stage NCC (Normalized Cross-Correlation) detector finds the watermark po **Speed**: ~0.05s per image. No GPU needed. -### 2. Invisible watermark removal +### Removing SynthID and other invisible watermarks -AI services (Google SynthID, StableSignature, TreeRing) embed imperceptible patterns in the frequency domain. These survive cropping, resizing, and JPEG compression. +Google embeds **SynthID** into every image generated by Gemini / Nano Banana. Other AI services use StableSignature, TreeRing, and similar schemes. These imperceptible frequency-domain patterns survive cropping, resizing, and JPEG compression. The removal pipeline: @@ -52,13 +68,14 @@ The key insight: even minimal noise injection (strength 0.02 = 2% perturbation) **Analog Humanizer**: optional film grain and chromatic aberration injection that makes the output indistinguishable from a photo of a screen, defeating AI-generated image classifiers. -### 3. AI metadata stripping +### Stripping C2PA, EXIF, and "Made with AI" metadata -AI tools embed generation metadata in multiple layers: +AI tools embed generation metadata that social platforms use to show "Made with AI" labels: -- **EXIF tags** — prompt, seed, model hash, sampler settings -- **PNG text chunks** — ComfyUI workflows, Stable Diffusion parameters -- **C2PA manifests** — Google Imagen, OpenAI DALL-E, Adobe Firefly provenance +- **EXIF tags** — prompt, seed, model hash, sampler settings (Stable Diffusion, Midjourney) +- **XMP DigitalSourceType** — `trainedAlgorithmicMedia` tag used by Instagram, Facebook, and X (Twitter) to show "Made with AI" +- **PNG text chunks** — ComfyUI workflows, AUTOMATIC1111 parameters +- **C2PA Content Credentials** — cryptographic provenance manifests from Google Imagen, OpenAI DALL-E, Adobe Firefly The cleaner parses each layer, removes AI-related fields, and preserves standard metadata (Author, Copyright, Title). @@ -153,13 +170,13 @@ remove-ai-watermarks batch ./images/ --mode all #### Individual commands ```bash -# Visible watermark only (Gemini sparkle) — fast, offline +# Visible watermark only (Gemini / Nano Banana sparkle) — fast, offline remove-ai-watermarks visible image.png -o clean.png # Invisible watermark only (SynthID etc.) — requires GPU remove-ai-watermarks invisible image.png -o clean.png --humanize 4.0 -# Check / strip AI metadata only +# Check / strip AI metadata (C2PA, EXIF, "Made with AI" labels) remove-ai-watermarks metadata image.png --check remove-ai-watermarks metadata image.png --remove diff --git a/data/samples/chatgpt-1.png b/data/samples/chatgpt-1.png new file mode 100644 index 0000000..2d284cb Binary files /dev/null and b/data/samples/chatgpt-1.png differ diff --git a/data/samples/chatgpt-2.png b/data/samples/chatgpt-2.png new file mode 100644 index 0000000..eb41401 Binary files /dev/null and b/data/samples/chatgpt-2.png differ diff --git a/data/samples/firefly-1.png b/data/samples/firefly-1.png new file mode 100644 index 0000000..4a0da9f Binary files /dev/null and b/data/samples/firefly-1.png differ diff --git a/data/samples/mj-1.png b/data/samples/mj-1.png new file mode 100644 index 0000000..9f0690b Binary files /dev/null and b/data/samples/mj-1.png differ diff --git a/data/samples/mj-2.png b/data/samples/mj-2.png new file mode 100644 index 0000000..b4ff1c6 Binary files /dev/null and b/data/samples/mj-2.png differ diff --git a/data/samples/nano_banana/Gemini_Generated_Image_qzmm8zqzmm8zqzmm.png b/data/samples/nano-banana-1.png similarity index 100% rename from data/samples/nano_banana/Gemini_Generated_Image_qzmm8zqzmm8zqzmm.png rename to data/samples/nano-banana-1.png diff --git a/data/samples/nano_banana/Gemini_Generated_Image_w9zmhbw9zmhbw9zm.png b/data/samples/nano-banana-2.png similarity index 100% rename from data/samples/nano_banana/Gemini_Generated_Image_w9zmhbw9zmhbw9zm.png rename to data/samples/nano-banana-2.png diff --git a/data/samples/not_ai/IMG_1432.jpeg b/data/samples/not-ai-1.jpeg similarity index 100% rename from data/samples/not_ai/IMG_1432.jpeg rename to data/samples/not-ai-1.jpeg diff --git a/data/samples/not_ai/IMG_3261.jpeg b/data/samples/not-ai-2.jpeg similarity index 100% rename from data/samples/not_ai/IMG_3261.jpeg rename to data/samples/not-ai-2.jpeg diff --git a/data/samples/not-ai-3.webp b/data/samples/not-ai-3.webp new file mode 100644 index 0000000..e05e356 Binary files /dev/null and b/data/samples/not-ai-3.webp differ diff --git a/pyproject.toml b/pyproject.toml index aef6e15..f2a7cbe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "remove-ai-watermarks" version = "0.2.2" -description = "Unified tool for removing visible and invisible AI watermarks from images" +description = "Remove visible and invisible AI watermarks from images (Gemini / Nano Banana, ChatGPT, Stable Diffusion)" readme = "README.md" requires-python = ">=3.10" license = {text = "MIT"}