AI Image Watermark Removal · Pixel-Level Verified Version
Removes white/semi-transparent corner watermarks ("XXAI Generated") from AI-generated images (Doubao/Jimeng/Kolors, etc.). Core selling points: Pixel-level verification prevents self-deception, dual-signal cross-localization fights hallucinations, multi-candidate objective metric voting ensures coverage — others just "tweak the AI and say it looks good"; this one is calculated.
Applicable Scenarios
- White/semi-transparent corner watermarks ("XXAI Generated") on AI-generated images (Doubao/Jimeng/Kolors, etc.)
- Watermarks on relatively uniform backgrounds (solid color blocks/sky/sea/gradients)
- Watermarks in image corners, not on the main subject
Full Pipeline (Relay Chain Reduces Error Correlation)
Watermark removal is a four-hop relay chain: Localization → Background Sampling → Coverage → Verification. Each hop independently introduces only small errors; after multiple hops, the correct rate drops sharply. Homogeneous methods all fall into the same trap. The thorough version = independent checks at key nodes + cross-principle signal cross-referencing + multi-candidate voting.
1 Localization (Two Signals Cross-Referenced, Must Be Different Principles)
- Signal A Grid Magnification Method: Magnify the candidate area and draw a 10x10 red grid (labeled x0-x9/y0-y9). Let the vision model only report "watermark in x?-x?, y?-y?" — trust only the grid range, not its percentage/pixel description. Convert back to original coordinates and then pixel-scan precisely.
- Signal B Pixel Density Clustering: No vision model-dependent pixel analysis. For white/semi-transparent colors (r>180,g>180,b>180; semi-transparent drops to 140-150), sum by rows to find text-dense row segments, and continuous column white pixels >3 to find text x range.
- Both A and B must locate the watermark area to lock it; only A or only B → re-examine, don't rush to overlay (cross-principle cross-referencing to avoid the same vision model falling into the same pit).
- Watermarks may be in corners (e.g., blue sea areas) rather than the subject — first scan the entire image for dense white/semi-transparent pixel clusters, then determine coordinates.
2 Coverage (Multi-Candidate Voting, Not Guesswork)
Generate multiple candidates and use objective metrics to vote for the best:
- Candidate 1: A background strip of the same width above (or to the left of) the watermark, vertically stretched to the watermark region (LANCZOS) — most natural for complex backgrounds.
- Candidate 2: Fill with the mean color from the left/surrounding area + mask with Gaussian feathering (GaussianBlur 2px) — for uniform backgrounds.
- Candidate 3: Multi-direction interpolation.
- Voting Metrics: Regional texture continuity (edge gradients) + color statistical variance + Euclidean distance from surrounding pixels. The best metric wins, not "I think this one looks better."
- Coverage area includes a 6-8px pad to prevent residual text edges.
3 Verification (Pixel-Level Judgment, Isolates Visual False Positives)
- Pixel-level ground truth run
scripts/verify_watermark_removed.py: Compare the white pixel count in the target region between the original and processed images. Original 856 → Processed 2 = Cleaned ✅ - The vision model does not participate in judgment; it only provides rough localization. Its false positives (complex backgrounds with white hair/water/fire highlights) for "still has watermark" are isolated from the node by pixel diff, not delaying progress.
- Residual Judgment: If the processed image's white pixels in the target region are less than 5% of the original's, it is considered removed.
Entire Chain (Managed Like a Distributed System)
- Each hop's input/output is strictly defined: bbox dictionary / candidate list / metrics, independently testable and reproducible.
- End-to-end: success rate (pixel pass rate) + cost (rounds) + debuggability, compared against a single-hop baseline — only deployed if net benefit is positive after costs.
Key Pitfalls (Real-World Lessons)
- Vision models will hallucinate "still has watermark": On complex backgrounds (white hair/water/fire highlights), they repeatedly falsely report "lower right corner has Doubao AI Generated", even when pixel-level proof shows it's removed. Pixel diff is the judge — once numerical thresholds are met, don't let the vision model push rework.
- The vision model saying "lower right corner" may mean the entire lower-right 1/4 region; precise coordinates must come from pixel analysis (row/column white density clustering).
- Bright image content (tiger's white fur/waterfall white waves) interferes with white detection — if the original is white and the processed version is also white everywhere, that's image content, not a watermark.
- On complex backgrounds, stretching the background strip above is more natural than solid color; solid color is only for uniform backgrounds (e.g., sea).
- Residual Judgment: If the processed image's white pixels in the target region are less than 5% of the original's, it is considered removed.
Script
scripts/verify_watermark_removed.py— Pixel-level verification of watermark removal (compares white pixel counts between original and processed images)
Dependencies
- Python 3,
PIL+numpy(pip install pillow numpy)
Limitations (Honest Disclosure)
- The coverage step uses "surrounding pixel stretch/mean fill," which is essentially pseudo-repair. If the watermark covers real content (faces/product logos/complex textures), the coverage will be distorted — you need genuine AI repair (inpainting/Lama).
- This skill excels at: AI-generated image corner watermarks, relatively uniform backgrounds, pixel-level fallback verification. Localization + verification are the strongest parts.
🙋 About the Author
Nine-grade Brocade Koi e | Encapsulating hard-won lessons into "grab-and-run" skills, not writing textbooks.
This skill is the version I use myself daily. If you get stuck, want advanced tricks, or have other scenarios you'd like me to package into a skill, add me on WeChat directly. When adding, note "SkillHub" for priority:

Scan to add the author on WeChat · Note "SkillHub" for priority