clean-scan

Clean scanned PDFs by classifying page types and optimizing cleaning parameters.

3|1|Updated Feb 26, 2026
One-click install
npx skills add https://github.com/imvladikon/dot-claude --skill clean-scan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-scan
Source: https://github.com/imvladikon/dot-claude/tree/main/skills/clean-scan
Command: npx skills add https://github.com/imvladikon/dot-claude --skill clean-scan

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires opencv-python, numpy.

What problem does it solve?

Очистка сканов PDF от серого и желтоватого фона с адаптивной подгонкой параметров под конкретный скан.

Core Features & Use Cases

  • Адаптивная очистка: подбор параметров очистки (kernel_size, percentile_low/percentile_high, whitening_threshold, sharpness) в зависимости от типа скана.
  • Классификация типов сканов: GRAY_UNIFORM, YELLOW_AGED, UNEVEN_LIGHTING, HIGH_CONTRAST, CLEAN, COLOR_PAGE.
  • Автоматический режим анализа нескольких страниц и согласование параметров для всего документа.
  • CLI-параметры: --auto, --test-page, --dpi, --skip-pages, --clahe для повышения качества.

Quick Start

Активируйте виртуальное окружение и запустите adaptive_cleaner.py с входным PDF и выходным файлом.

Frequently Asked Questions about clean-scan

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I remove gray or yellow backgrounds from scanned PDFs for OCR preprocessing?

Adaptive PDF scan cleaning removes gray or yellow backgrounds by classifying scan types like YELLOW_AGED or UNEVEN_LIGHTING and optimizing parameters such as percentile thresholds and whitening levels per page. This automated process ensures clean, high-contrast output for OCR preprocessing.

What is the best way to automate scan cleaning for a multi-page PDF document?

Automating scan cleaning for a multi-page PDF involves analyzing several pages to agree on consistent cleaning parameters across the entire document. Using a command-line interface with an --auto flag, the system applies per-page feature analysis to select the optimal kernel size and sharpness settings globally.

Does OpenCV support adaptive background removal for unevenly lit PDF scans?

OpenCV supports adaptive background removal for unevenly lit PDF scans by applying per-page feature analysis and scan-type classification. The process adjusts parameters like percentile_low and percentile_high, and can apply CLAHE to effectively whiten uneven backgrounds and enhance readability.

Can I skip specific pages when running automated PDF scan cleaning?

You can skip specific pages during automated PDF scan cleaning by using the --skip-pages CLI parameter. This allows the adaptive cleaner to bypass unwanted pages, applying the optimized background removal and whitening threshold only to the targeted sections of the document.

How do I test scan cleaning parameters on a single page before processing a full PDF?

To test scan cleaning parameters on a single page before processing a full PDF, use the --test-page CLI parameter. This runs the adaptive parameter optimization and feature analysis on one specified page, allowing you to verify kernel size and sharpness adjustments before full execution.

Why does my PDF scan still show gray backgrounds after automated cleaning?

A PDF scan may still show gray backgrounds after automated cleaning if the scan-type classification mismatched the page features or if the whitening_threshold was insufficient. Adjusting the --dpi setting or enabling --clahe can improve contrast and correct uneven lighting artifacts.