scan-watermark-removal
БесплатноЗапускает вложенные скриптыНе проверенDeterministically remove light translucent text watermarks from scanned paper pages (lecture notes, handouts, exam papers, workbooks) as images or PDF, plus…
от c0s1n3314 установок в других каталогахОб этом скилле
Scan Watermark Removal
Remove two different things that both get called "watermark" on scanned course material:
| Family | Looks like | Method |
|---|---|---|
| Translucent text | pale pink/purple diagonal tiled text over the whole page | colour-cone pixel isolation |
| Printed header logo | solid coloured brand text (e.g. a teacher's name) in the page header | colour wedge + shape test, header band only |
Both are deterministic: no model, no generative redraw, no network. Red pen, black print, blue table rules, grey figures and colour illustrations survive 100% — verified by pixel accounting on every page.
When to use
- Scanned lecture notes / handouts / exam papers with pale diagonal watermark text tiled across the paper.
- PDF bundles of such scans, where the watermark is baked into the page bitmap.
- Pages carrying a printed coloured logo in the header that the user wants gone.
When NOT to use
- Photo watermarks, stock-photo overlays, or semi-transparent logos over busy imagery — the paper-white assumption does not hold.
- Dark, saturated, or photographic logos. Only light translucent overlays and flat-colour printed header text are in scope.
- Watermark colour within a few units of the content colour. Ink protection will bail out and leave it behind, which is the correct trade — do not force it.
- Do not reach for generative image-editing tools on this material. On a dense handwriting page they repaint the whole page and swallow most of the red ink, then leave pink fringes around remaining strokes. Measured: ~75% of red handwriting lost on the worst page. If a generative tool is the only option, say so and require per-page review.
Workflow
1. Look before you cut
Open 2–3 pages at full resolution. Identify which families are present:
- pale diagonal tiled text → translucent watermark
- solid coloured text in the header → printed logo
- both → handle both (the tool does, by default)
2. Sample the watermark colour
Pick a patch of paper that has watermark but no content, read the RGB. Typical measured values:
| Watermark | Sample colour | Signal |
|---|---|---|
| pink | (244,191,191) | r-g ≈ 53, ` |
| purple | (200,190,215) | b-g ≈ 20, ` |
| header logo | (255,192,0) | r-g = 63, b = 0 |
If the sampled colour is far from these, adjust the constants at the top of
scripts/wmcore.py (PINK, PURPLE, FAINT) — see
references/watermark-signature.md for how to derive thresholds.
3. Run
# image folder or single image
python scripts/remove_watermark.py <folder_or_image>
# PDF
python scripts/remove_watermark.py <file.pdf> --output <out.pdf>
Defaults: output <input>/去水印输出/ for images, <name>_去水印.pdf for PDF;
suffix _去水印; both colour cones on; header logo cleared. Originals are never
modified.
Useful flags: --near (ink-protection window, default 5), --no-logo,
--no-pink, --no-purple, --all (reprocess already-suffixed files).
4. Read the metrics — this is the acceptance gate
Every page prints:
erasedpx → must be 0. Pixels that were unambiguously content (darkmin < 120, saturated red, saturated blue) and are now near-white. This is the real safety metric.residuepx plusvisiblein parentheses → watermark pixels on clean paper, and how many are dark enough to actually be seen. Visible must be ~0; the raw count is often in the thousands on a JPEG page and means nothing.red / dark / blueretention % → coverage reference only, expected ≥ 90.
Why erased rather than a retention percentage: JPEG re-encoding shifts the
palest antialiased edges by a few units, which pushes a percent or two of them
below the "is this content" threshold. Retention can read 91% on a page where
zero real pixels were lost. Percentage thresholds therefore either fail correct
output or invite loosening until they hide real damage. Counting documented
content that disappeared has neither problem.
To audit the old way anyway, print the original min channel of every lost pixel:
deficits from min ∈ [120,150] are edge jitter, min < 100 is real loss.
Exit code 0 means all pages passed. Non-zero lists the specific pages.
5. Verify independently for big batches (≥ 50 pages)
python scripts/verify_batch.py <original folder>
python scripts/verify_batch.py <original.pdf> --output <out.pdf>
It recomputes retention and residue from scratch using the output naming rule, so it catches what self-checks miss: wrong output filenames, silently lost content, and header logos that survived. Always run it before telling the user a large batch is done.
6. Spot-check 2–3 pages by eye
Confirm headings, page numbers, handwritten formulas and diagrams are intact, and that no diagonal ghost lines remain on near-blank pages (back covers and chapter dividers expose residue most readily).
How it works
Translucent text watermark
The watermark is a uniform colour
Установить scan-watermark-removal в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл scan-watermark-removal?
Deterministically remove light translucent text watermarks from scanned paper pages (lecture notes, handouts, exam papers, workbooks) as images or PDF, plus printed coloured header logos. Use when the user asks to 去水印 / remove watermark / clean watermarks from 扫描笔记、讲义、试卷、资料图片、PDF 讲义, especially batches of course-note scans with pale diagonal tiled text (WeChat id, brand name, URL) or a brand logo in the page header. Not for photo watermarks, dark or photographic logos, or cases where the watermark colour is indistinguishable from content — those need generative inpainting instead, which redraws the page and can destroy handwriting, so warn the user and require per-page review.
Как установить скилл scan-watermark-removal?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл scan-watermark-removal запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic