pagescan.scan#
- pagescan.scan(image_path, output_path=None, config=None)[source]#
Scan a single document photo into a clean PDF.
- Pipeline:
Load image
Detect corners (ML with validation, or conservative crop)
Perspective transform or direct crop
Auto-rotate (OCR-based orientation correction)
Deskew (Hough-based text tilt correction)
Shadow removal + white balance
Scan-like enhancement (grayscale, contrast, sharpen)
Place on canvas (A4) and save as PDF
- Parameters:
image_path (
str) – Path to input image (JPEG, PNG, TIFF).output_path (
str|None) – Path for output PDF. If None, replaces extension with .pdf.config (
ScanConfig|None) – Scan configuration. Uses defaults if None.
- Returns:
success, quality_score, quality_passed, message, output_path.
- Return type: