Agent skill

ocrmypdf-image

OCRmyPDF image processing skill — deskew, rotate, clean, despeckle, remove border from scanned documents. Use when the user needs to improve scanned PDF quality, fix skewed pages, remove noise, or clean up scanned documents before OCR.

Stars 254
Forks 41

Install this agent skill to your Project

npx add-skill https://github.com/partme-ai/full-stack-skills/tree/main/skills/ocrmypdf-skills/ocrmypdf-image

SKILL.md

OCRmyPDF — Image Processing Guide

Overview

OCRmyPDF includes powerful image processing capabilities to improve scan quality before OCR. These tools help fix skewed pages, remove noise, clean borders, and enhance readability.

For core OCR functionality, see the ocrmypdf skill. For optimization and PDF/A options, see ocrmypdf-optimize. For batch/Docker/scripting, see ocrmypdf-batch.

Deskew

Deskew corrects pages that are slightly rotated (e.g., from feed scanner skew).

bash
# Auto deskew (recommended)
ocrmypdf --deskew input.pdf output.pdf

# Force deskew even if rotation is minimal
ocrmypdf --deskew --force-ocr input.pdf output.pdf

Rotation

Rotate pages to correct upside-down or sideways scans:

bash
# Auto-rotate based on text orientation
ocrmypdf --rotate-pages input.pdf output.pdf

# Force rotate all pages
ocrmypdf --rotate-pages --force-ocr input.pdf output.pdf

Remove Borders / Cleaning

Remove unwanted borders, artifacts, and noise from scanned pages:

bash
# Remove borders (dots, solid borders)
ocrmypdf --remove-bordering input.pdf output.pdf

# Combine with cleanup
ocrmypdf --remove-bordering --clean input.pdf output.pdf

Despeckle

Remove speckles and isolated noise pixels:

bash
# Remove speckles
ocrmypdf --despeckle input.pdf output.pdf

# Aggressive despeckle for very noisy scans
ocrmypdf --despeckle --clean input.pdf output.pdf

Unpaper

unpaper provides advanced post-processing:

bash
# Apply unpaper with default settings
ocrmypdf --unpaper input.pdf output.pdf

# Custom unpaper board options
ocrmypdf --unpaper-args "--board A4" input.pdf output.pdf

Oversampling

Increase image resolution before OCR for better accuracy:

bash
# Oversample to 300 DPI before OCR
ocrmypdf --oversample 300 input.pdf output.pdf

# Common for low-resolution scans
ocrmypdf --oversample 400 input.pdf output.pdf

Combined Recipes

Fix a skewed scan

bash
ocrmypdf --deskew --remove-bordering --despeckle scanned.pdf fixed.pdf

Clean up a very noisy scan

bash
ocrmypdf --deskew --rotate-pages --despeckle --clean --oversample 300 noisy.pdf clean.pdf

Remove all artifacts

bash
ocrmypdf --remove-bordering --unpaper --despeckle dirty.pdf clean.pdf

Quick Reference

Task Command
Auto deskew --deskew
Auto rotate --rotate-pages
Remove borders --remove-bordering
Remove speckles --despeckle
Unpaper --unpaper
Oversample DPI --oversample N

Troubleshooting

  • Poor OCR after cleaning: Try --oversample 300 to increase input quality.
  • Artifacts remain: Use --unpaper for aggressive cleanup.
  • Over-cleaned image: Reduce cleaning options for preserve original quality.

Expand your agent's capabilities with these related and highly-rated skills.

partme-ai/full-stack-skills

ocrmypdf-batch

OCRmyPDF batch processing skill — process multiple PDFs, Docker automation, shell scripting, and CI/CD integration. Use when the user needs to OCR many PDFs, set up automated OCR pipelines, or integrate OCR into workflows.

254 41
Explore
partme-ai/full-stack-skills

ocrmypdf-optimize

OCRmyPDF optimization skill — compress PDFs, configure PDF/A output, JBIG2 encoding, and lossless optimization. Use when the user needs to reduce PDF file size, create archival PDF/A files, or optimize OCR output.

254 41
Explore
partme-ai/full-stack-skills

ocrmypdf-api

OCRmyPDF Python API and plugin skill — use OCRmyPDF programmatically from Python, integrate with applications, and extend with plugins (EasyOCR, PaddleOCR, AppleOCR). Use when the user needs to call OCRmyPDF from Python code, build OCR pipelines, or use alternative OCR engines.

254 41
Explore
partme-ai/full-stack-skills

ocrmypdf

OCRmyPDF core skill — add searchable OCR text layer to scanned PDFs, convert images to searchable PDFs, support 100+ languages via Tesseract. Use when the user needs to OCR a PDF, make a scanned PDF searchable, or extract text from scanned documents.

254 41
Explore
partme-ai/full-stack-skills

svelte

Guides Svelte and SvelteKit development including reactive components, stores, transitions, lifecycle hooks, SSR, file-based routing, and deployment. Use when the user needs to build Svelte components, create SvelteKit applications, implement reactivity patterns, or configure Svelte with Vite.

254 41
Explore
partme-ai/full-stack-skills

tui-empty

Generate and render a pixel-precise ASCII TUI Empty State component with complete output blocks (TUI_RENDER, COMPONENT_SPEC, PENCIL_SPEC, PENCIL_BATCH_DESIGN) for Pencil MCP drawing workflows. Use when the user asks to create an empty state in a terminal UI, text-based interface, or Pencil MCP project.

254 41
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results