[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-78638":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":9,"rankLanguage":9,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":9,"pushedAt":9,"updatedAt":37,"readmeContent":38,"aiSummary":39,"trendingCount":15,"starSnapshotCount":15,"syncStatus":40,"lastSyncTime":41,"discoverSource":42},78638,"remove-ai-watermarks","wiltodelta\u002Fremove-ai-watermarks","wiltodelta","AI watermark remover. CLI and Python library to strip visible and invisible AI watermarks (Gemini \u002F Nano Banana sparkle, SynthID) and provenance metadata (C2PA, EXIF, IPTC) from images.",null,"Python",3127,272,6,1,0,145,378,1095,435,29.31,"MIT License",false,"main",true,[26,27,28,29,30,31,32,33,34,35,36],"ai","c2pa","cli","computer-vision","diffusion-models","gemini","image-processing","metadata","python","synthid","watermark-removal","2026-06-12 02:03:48","# Remove-AI-Watermarks\n\nRemove **visible** and **invisible** AI watermarks from images generated by Google Gemini (Nano Banana), ChatGPT \u002F DALL-E, Stable Diffusion, Adobe Firefly, Midjourney, and other AI models.\n\nStrips SynthID, C2PA Content Credentials, EXIF\u002FXMP \"Made with AI\" labels, and visible sparkle overlays — all in one command.\n\n## Features\n\n- **Visible watermark removal** — Gemini \u002F Nano Banana sparkle logo via reverse alpha blending (fast, offline, deterministic)\n- **Invisible watermark removal** — SynthID, StableSignature, TreeRing via diffusion-based regeneration\n- **AI metadata stripping** — EXIF, PNG text chunks, C2PA provenance manifests (PNG \u002F JPEG \u002F AVIF \u002F HEIF \u002F JPEG-XL), XMP DigitalSourceType\n- **\"Made with AI\" label removal** — removes the metadata that triggers AI labels on Instagram, Facebook, X (Twitter)\n- **Analog Humanizer** — film grain and chromatic aberration to bypass AI image classifiers\n- **Smart Face Protection** — automatic extraction and blending of human faces to prevent AI distortion\n- **Batch processing** — process entire directories\n- **Detection** — three-stage NCC watermark detection with confidence scoring\n\n> **Try it online** — don't want to install anything? Use [raiw.cc](https:\u002F\u002Fraiw.cc), a free web service powered by this library.\n\n## Examples\n\n| Before (Watermarked) | After (Cleaned) |\n| --- | --- |\n| ![Before](demo_banana_before.png) | ![After](demo_banana_after.png) |\n\n## Supported models\n\n| AI model | Visible watermark | Invisible watermark | Metadata | Our approach |\n| --- | --- | --- | --- | --- |\n| **Google Gemini \u002F Nano Banana \u002F Gemini 3 Pro** | ✅ Sparkle logo | ✅ SynthID v1 + v2 (default SDXL pipeline at native ~1024 px) | ✅ C2PA + EXIF | Alpha reversal + diffusion + metadata strip |\n| **OpenAI DALL-E 3 \u002F ChatGPT** | — | — | ✅ C2PA manifest | Metadata strip |\n| **OpenAI ChatGPT Images 2.0** (gpt-image-2) | — | ⚠️ imperceptible pixel watermark (no public detector yet) | ✅ C2PA manifest (verified) | Diffusion regeneration + metadata strip |\n| **Stable Diffusion (AUTOMATIC1111, ComfyUI)** | — | ✅ DWT \u002F steganographic | ✅ PNG text chunks | Diffusion regeneration + metadata strip |\n| **Adobe Firefly** | — | — | ✅ Content Credentials (C2PA) | Metadata strip |\n| **Midjourney** | — | — | ✅ EXIF + XMP (prompt, model, seed) | Metadata strip |\n| **StableSignature** (Meta) | — | ✅ In-model watermark | — | Diffusion regeneration |\n| **TreeRing** | — | ✅ Latent space watermark | — | Diffusion regeneration |\n\n> Visible watermarks (logo overlays) are currently used only by Google Gemini \u002F Nano Banana. Other services rely on invisible watermarks and\u002For metadata. Our diffusion-based regeneration works against any invisible watermark in pixel or frequency domain.\n\n## How it works\n\n### Removing the Gemini \u002F Nano Banana sparkle watermark\n\nGoogle Gemini (internally codenamed **Nano Banana**) adds a visible sparkle logo to generated images using alpha blending:\n\n```text\nwatermarked = α × logo + (1 − α) × original\n```\n\nWe reverse this with a known alpha map (extracted from Gemini \u002F Nano Banana output on a pure-black background):\n\n```text\noriginal = (watermarked − α × logo) \u002F (1 − α)\n```\n\nA three-stage NCC (Normalized Cross-Correlation) detector finds the watermark position and scale dynamically, so it works even if the image was resized or cropped. After removal, residual sparkle-edge artifacts are cleaned via gradient-masked inpainting.\n\n**Speed**: ~0.05s per image. No GPU needed.\n\n### Removing SynthID and other invisible watermarks\n\nGoogle embeds **SynthID** into every image generated by Gemini \u002F Nano Banana. Other AI services use StableSignature, TreeRing, and similar schemes. These imperceptible frequency-domain patterns survive cropping, resizing, and JPEG compression.\n\nThe removal pipeline (default profile, SDXL):\n\n```text\nimage → resize to ~1024px (SDXL native) → encode to latent space (VAE)\n      → add controlled noise (forward diffusion)\n      → denoise (reverse diffusion, ~50 steps at strength 0.05)\n      → decode back to pixels (VAE) → upscale to original resolution\n```\n\nSDXL is the default since May 2026: empirically defeats SynthID v2 on Gemini 3 Pro outputs, where the older SD-1.5 pipeline at 768 px did not. The SD-1.5 path was removed once it was verified not to handle v2.\n\n**Face Protection**: before diffusion, YOLO detects people in the image and extracts them. After diffusion, the original faces are blended back with a soft elliptical mask to prevent AI distortion of facial features.\n\n**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.\n\n### Stripping C2PA, EXIF, and \"Made with AI\" metadata\n\nAI tools embed generation metadata that social platforms use to show \"Made with AI\" labels:\n\n- **EXIF tags** — prompt, seed, model hash, sampler settings (Stable Diffusion, Midjourney)\n- **XMP DigitalSourceType** — `trainedAlgorithmicMedia` tag used by Instagram, Facebook, and X (Twitter) to show \"Made with AI\"\n- **PNG text chunks** — ComfyUI workflows, AUTOMATIC1111 parameters\n- **C2PA Content Credentials** — cryptographic provenance manifests from Google Imagen, OpenAI DALL-E, Adobe Firefly\n\nThe cleaner parses each layer, removes AI-related fields, and preserves standard metadata (Author, Copyright, Title).\n\n## Installation\n\n### Recommended\n\nInstall as an isolated CLI tool — no need to manage virtual environments:\n\n```bash\n# Using pipx (https:\u002F\u002Fpipx.pypa.io)\npipx install git+https:\u002F\u002Fgithub.com\u002Fwiltodelta\u002Fremove-ai-watermarks.git\n\n# Or using uv (https:\u002F\u002Fdocs.astral.sh\u002Fuv)\nuv tool install git+https:\u002F\u002Fgithub.com\u002Fwiltodelta\u002Fremove-ai-watermarks.git\n```\n\nTo update to the latest version:\n\n```bash\npipx upgrade remove-ai-watermarks\n\n# or\nuv tool upgrade remove-ai-watermarks\n```\n\n### Install from repository\n\n**Prerequisites:** Python 3.10+ and `pip` (or [`uv`](https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002F)).\n\n```bash\n# 1. Clone the repository\ngit clone https:\u002F\u002Fgithub.com\u002Fwiltodelta\u002Fremove-ai-watermarks.git\ncd remove-ai-watermarks\n\n# 2. Install the package in editable mode\npip install -e .\n\n# Or, if you use uv:\nuv pip install -e .\n```\n\nAfter installation the `remove-ai-watermarks` command is available system-wide.\n\n> **Note**: The base install covers visible watermark removal and metadata stripping.\n> For invisible watermark removal (SynthID etc.), install GPU dependencies:\n>\n> ```bash\n> pip install -e \".[gpu]\"   # or: uv pip install -e \".[gpu]\"\n> ```\n\n#### Invisible watermark removal\n\nInvisible removal uses diffusion models and a GPU for reasonable speed.\n\n```bash\n# On first run, the model (~2 GB) will be downloaded automatically.\n# Device is auto-detected: CUDA (Linux\u002FWindows) > MPS (macOS) > CPU.\n# To force a device: --device cuda \u002F --device mps \u002F --device cpu\n\n# Optional: set a HuggingFace token for gated\u002Fprivate models\ncp .env.example .env\n# Edit .env and set HF_TOKEN=hf_your_token_here\n```\n\n#### Developer setup\n\n```bash\n# Install with dev dependencies (pytest, ruff, pyright)\npip install -e \".[dev]\"\n# Or with uv:\nuv pip install -e \".[dev]\"\n\n# Run tests\npytest\n\n# Run linters\n.\u002Fmaintain.sh\n```\n\n## Usage\n\n### CLI\n\n```bash\n# Remove all watermarks from a single image (visible + invisible + metadata)\nremove-ai-watermarks all image.png -o clean.png\n\n# Process an entire directory\nremove-ai-watermarks batch .\u002Fimages\u002F --mode all\n```\n\n#### Individual commands\n\n```bash\n# Visible watermark only (Gemini \u002F Nano Banana sparkle) — fast, offline\nremove-ai-watermarks visible image.png -o clean.png\n\n# Invisible watermark only (SynthID etc.) — requires GPU\nremove-ai-watermarks invisible image.png -o clean.png --humanize 4.0\n\n# Check \u002F strip AI metadata (C2PA, EXIF, \"Made with AI\" labels)\nremove-ai-watermarks metadata image.png --check\nremove-ai-watermarks metadata image.png --remove\n\n# Batch with a specific mode\nremove-ai-watermarks batch .\u002Fimages\u002F --mode visible\n```\n\n### Python API\n\n```python\nfrom remove_ai_watermarks.gemini_engine import GeminiEngine\nimport cv2\n\nengine = GeminiEngine()\nimage = cv2.imread(\"watermarked.png\")\n\n# Detect\nresult = engine.detect_watermark(image)\nprint(f\"Detected: {result.detected} (confidence: {result.confidence:.1%})\")\n\n# Remove\nclean = engine.remove_watermark(image)\ncv2.imwrite(\"clean.png\", clean)\n```\n\n### Metadata stripping\n\n```python\nfrom remove_ai_watermarks.metadata import has_ai_metadata, remove_ai_metadata\nfrom pathlib import Path\n\nif has_ai_metadata(Path(\"image.png\")):\n    remove_ai_metadata(Path(\"image.png\"), Path(\"clean.png\"))\n```\n\n## Requirements\n\n- Python ≥ 3.10\n- **Visible removal \u002F metadata**: CPU only, no GPU required\n- **Invisible removal**: GPU recommended (CUDA or MPS), works on CPU (slow)\n\n## Troubleshooting\n\n**SSL certificate error** (`CERTIFICATE_VERIFY_FAILED`):\n\n```bash\n# Install certifi (the tool auto-detects it)\npip install certifi\n\n# macOS only: run the Python certificate installer\n\u002FApplications\u002FPython\\ 3.*\u002FInstall\\ Certificates.command\n```\n\n**First run is slow** — this is expected. The tool downloads model weights (~2 GB) on first launch. Subsequent runs use cached models.\n\n## Credits\n\n- [noai-watermark](https:\u002F\u002Fgithub.com\u002Fmertizci\u002Fnoai-watermark) by mertizci — invisible watermark removal engine\n- [GeminiWatermarkTool](https:\u002F\u002Fgithub.com\u002Fallenk\u002FGeminiWatermarkTool) by Allen Kuo (MIT) — visible watermark removal algorithm\n- [CtrlRegen](https:\u002F\u002Fgithub.com\u002Fyepengliu\u002FCtrlRegen) by Liu et al. (ICLR 2025) — controllable regeneration pipeline\n- NeuralBleach (MIT) — analog humanizer technique\n\n## Roadmap\n\nTracked but not yet implemented:\n\n- **SynthID-Image v2 automated regression test**. The default SDXL profile defeats v2 per manual checks against the [Gemini app](https:\u002F\u002Fsupport.google.com\u002Fgemini\u002Fanswer\u002F16722517)'s \"Verify with SynthID\" feature on a Gemini 3 Pro output (May 2026). An automated end-to-end test would need either programmatic access to the [SynthID Detector portal](https:\u002F\u002Fblog.google\u002Finnovation-and-ai\u002Fproducts\u002Fgoogle-synthid-ai-content-detector\u002F) (waitlist for media professionals and researchers) or an offline surrogate detector. Open.\n- **AVIF \u002F HEIF \u002F JPEG-XL detection limits**. Removal strips top-level C2PA `uuid` and JUMBF `jumb` boxes. EXIF\u002FXMP boxes inside these containers are not yet scrubbed (PNG and JPEG are fully covered).\n- **Video pipeline (`noai-video`)**: per-frame inpainting and tracking for Sora 2 dynamic logo, Veo 3.1 badge, Kling, Runway. Separate package, not folded into this repo.\n\nWon't fix:\n\n- **Nightshade \u002F Glaze \u002F PhotoGuard removal**. These are defensive perturbations used by artists to protect their work from being scraped into AI training sets. Removing them attacks artists, not AI provenance. Out of scope.\n\n## Legal\n\nWatermarking and provenance for AI-generated content is now regulated in several jurisdictions. The table below summarises the May 2026 status. None of this is legal advice.\n\n| Jurisdiction | Instrument | Status (May 2026) | Relevance |\n| --- | --- | --- | --- |\n| EU | AI Act, Article 50(2) | Marking obligations postponed to **2 December 2026** under the December 2025 omnibus agreement. Code of Practice finalising May\u002FJune 2026. | Removing mandated provenance markers with intent to deceive may be sanctioned under national implementations. |\n| US (federal) | COPIED Act | Enacted 2025. | Criminalises removal of provenance information with intent to deceive about content origin. The tool itself is lawful; usage may not be. |\n| US (state) | CA AB 2655, TX SB 751, similar | In force. | Content-specific (election deepfakes, sexual deepfakes). Not tool-specific. |\n| China | Deep Synthesis Regulation, 2025 updates | In force. | Mandatory visible label for AI content. Removal is an administrative offence. |\n| UK | Online Safety Act, 2025 transparency extension | In force. | Platform obligations, not user obligations. |\n\n## Threat model\n\nThis tool defends already-distributed AI imagery against automatic detection systems (social-platform \"Made with AI\" labels, third-party classifiers, content-policy filters). It does **not** retroactively anonymise generation.\n\nIn particular, **SynthID-Image v2** (Google, deployed October 2025 with Gemini 3 Pro \u002F Nano Banana Pro \u002F Imagen 4 \u002F Veo) embeds a **136-bit payload** ([arxiv 2510.09263](https:\u002F\u002Farxiv.org\u002Fabs\u002F2510.09263)). The payload is believed to encode a user \u002F session identifier. If the original watermarked file ever passed through a system controlled by the prompt originator (a saved Gemini account history, a screenshot uploaded to a Google product, a backup), Google retains the ability to link that original to the generating account. Stripping the watermark from a copy you possess does not erase Google's server-side record.\n\nUse cases where the threat model fits:\n- You generated the image yourself, want to publish it as your own work, and accept the consequences if Google ever publishes their detector logs.\n- You are running a security \u002F robustness evaluation.\n- You are preserving art or historical record against false-positive \"AI-generated\" labels.\n\nUse cases where the threat model **does not** fit:\n- Generating an image, expecting that removing the watermark anonymises you to Google. It doesn't.\n- Distributing AI-generated content while claiming human authorship. The watermark is one of several traceability layers.\n\nThis tool is intended for legitimate purposes such as:\n\n- Privacy protection (removing metadata that leaks user account identifiers).\n- Art preservation and fair-use research.\n- Removing false-positive \"Made with AI\" labels from human-edited photographs.\n- Security research and watermark robustness study.\n\nRemoving AI provenance markers to misrepresent AI-generated content as human-created may violate the laws above, the DMCA, and platform terms of service. Users are solely responsible for ensuring their use complies with all applicable laws. The authors do not condone use of this tool for deception, fraud, or any activity that violates applicable laws or regulations.\n\n## License\n\nMIT\n","该项目旨在通过命令行界面和Python库去除AI生成图像中的可见与不可见水印及来源元数据（如SynthID、C2PA、EXIF\u002FXMP \"Made with AI\"标签、Gemini闪光等）。其核心功能包括使用反向Alpha混合技术快速移除Gemini\u002FNano Banana的可见水印，基于扩散模型再生技术清除隐形水印，以及剥离可能触发社交媒体平台AI标签的各类元数据。此外，还提供了批量处理能力、三阶段NCC水印检测机制，并支持智能人脸保护以避免在处理过程中产生失真。适用于需要对AI生成内容进行匿名化处理或版权清理的场景，如数字艺术创作、隐私保护等领域。",2,"2026-06-11 03:57:06","high_star"]