Skip to content

Latest commit

 

History

History
45 lines (30 loc) · 987 Bytes

File metadata and controls

45 lines (30 loc) · 987 Bytes

pdf2scan

Bash script for enhancing scanned/book PDFs. Renders pages to grayscale, applies gamma and contrast, optionally converts to 1-bit (threshold/adaptive), then merges into a compact printable PDF. Parallel and memory-aware.

demo

Requirements

Ghostscript, ImageMagick, img2pdf, GNU parallel, poppler

Ubuntu

sudo apt install ghostscript imagemagick img2pdf parallel poppler-utils

Fedora

sudo dnf install ghostscript ImageMagick img2pdf parallel poppler-utils

Arch

sudo pacman -S ghostscript imagemagick img2pdf parallel poppler

Usage

./pdf2scan.sh [options] input.pdf output.pdf

Options:

  • -d, --dpi render DPI (default 100)
  • -g, --gamma gamma correction
  • -c, --contrast brightness/contrast
  • -t, --threshold convert to 1-bit (e.g. 50%)
  • -a, --adaptive adaptive 1-bit
  • -q, --quality JPEG quality (default 60)
  • -v, --verbose verbose logs
  • -h, --help show help