ocr
/ocr
Optical Character Recognition for scanned documents and images. Covers Tesseract, EasyOCR, PaddleOCR, AWS Textract, Azure Document Intelligence, Google Document AI, and Anthropic Claude vision. Preprocessing (deskew, denoise, binarize). USE WHEN: user mentions "OCR", "scanned PDF", "Tesseract", "Textract", "EasyOCR", "PaddleOCR", "Document AI", "Claude vision OCR", "image to text" DO NOT USE FOR: born-digital PDFs with selectable text - use `pdf-extraction`; table-only extraction - use `table-extraction`
- Author
- claude-dev-suite ↗
- Repository
- claude-dev-suite ↗
- Licence
- MIT
- Last repository change
- 21.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 21.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Optical Character Recognition for scanned documents and images. Covers Tesseract, EasyOCR, PaddleOCR, AWS Textract, Azure Document Intelligence, Google Document AI, and Anthropic Claude vision. Preprocessing (deskew, denoise, binarize). USE WHEN: user mentions "OCR", "scanned PDF", "Tesseract", "Textract", "EasyOCR", "PaddleOCR", "Document AI", "Claude vision OCR", "image to text" DO NOT USE FOR: born-digital PDFs with selectable text - use `pdf-extraction`; table-only extraction - use `table-extraction`
Triggers from the description
Original author description
Optical Character Recognition for scanned documents and images. Covers Tesseract, EasyOCR, PaddleOCR, AWS Textract, Azure Document Intelligence, Google Document AI, and Anthropic Claude vision. Preprocessing (deskew, denoise, binarize). USE WHEN: user mentions "OCR", "scanned PDF", "Tesseract", "Textract", "EasyOCR", "PaddleOCR", "Document AI", "Claude vision OCR", "image to text" DO NOT USE FOR: born-digital PDFs with selectable text - use `pdf-extraction`; table-only extraction - use `table-extraction`
How it works
- Engine Comparison
- Tesseract
- Image Preprocessing
- EasyOCR
- PaddleOCR
- AWS Textract (Sync + Async)
- Azure Document Intelligence
- Google Document AI
- Anthropic Claude Vision for OCR
- Hybrid Pipeline (fast + accurate fallback)
SKILL.md preview
---
name: ocr
description: |
Optical Character Recognition for scanned documents and images. Covers Tesseract,
EasyOCR, PaddleOCR, AWS Textract, Azure Document Intelligence, Google Document
AI, and Anthropic Claude vision. Preprocessing (deskew, denoise, binarize).
USE WHEN: user mentions "OCR", "scanned PDF", "Tesseract", "Textract",
"EasyOCR", "PaddleOCR", "Document AI", "Claude vision OCR", "image to text"
DO NOT USE FOR: born-digital PDFs with selectable text - use `pdf-extraction`;
table-only extraction - use `table-extraction`
allowed-tools: Read, Grep, Glob, Write, Edit
---
# OCR
## Engine Comparison
| Engine | Accuracy | Speed | Languages | Layout | Cost |
|--------|----------|-------|-----------|--------|------|
| Tesseract 5 | Good | Fast | 100+ | Basic (PSM) | Free |
| EasyOCR | Good | Medium | 80+ | Basic | Free |
| PaddleOCR | Very good | Medium | 80+ | PP-Structure | Free |
| AWS Textract | Excellent | Fast (API) | Many | Forms+tables+queries | Per-page |
| Azure Doc Intelligence | Excellent | Fast (API) | Many | Prebuilt + layout | Per-page |
| Google Document AI | Excellent | Fast (API) | Many | Processors | Per-page |
| Claude vision | Excellent | Medium | Many | Semantic | Per-token |
## Tesseract
```python
import pytesseract
from PIL import Image
# Basic
text = pytesseract.image_to_string(Image.open("scan.png"), lang="eng")
# Tuned: Page Segmentation Mode + OCR Engine Mode
config = r"--oem 3 --psm 6 -c preserve_interword_spaces=1"
text = pytesseract.image_to_string(Image.open("scan.png"), lang="eng+deu", config=config)
# Word-level boxes + confidences
data = pytesseract.image_to_data(
Image.open("scan.png"),
output_type=pytesseract.Output.DICT,
config="--psm 6",
)
for i, word in enumerate(data["text"]):
if word.strip() and int(data["conf"][i]) > 60:
print(word, data["left"][i], data["top"][i], data["conf"][i])
```
### PSM Modes (Page Segmentation)
| PSM | Use |
|-----|-----|
| 3 | Default: auto page segmentation |
| 4 | Single column of text of variable sizes |
| 6 | Single uniform block of text (most common) |
| 7 | Single text line |
| 8 | Single word |
| 11 | Sparse text, find as much as possible |
| 12 | Sparse text with OSD |
## Image Preprocessing
```python
import cv2
import numpy as np
def preprocess(path: str) -> np.ndarray:
img = cv2.imread(path)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# Denoise
gray = cv2.fastNlMeansDenoising(gray, h=15)
# Deskew
coords = np.column_stack(np.where(gray < 200))
angle = cv2.minAreaRect(coords)[-1]
angle = -(90 + angle) if angle < -45 else -angle
(h, w) = gray.shape
M = cv2.getRotationMatrix2D((w // 2, h // 2), angle, 1.0)
rotated = cv2.warpAffine(gray, M, (w, h), flags=cv2.INTER_CUBIC, borderMode=cv2.BORDER_REPLICATE)
# Binarize (Otsu + adaptive fallback)
_, binary = cv2.threshold(rotated, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
# Morphological cleanup
kernel = np.ones((1, 1), np.uint8)
binary = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, kernel)
return binary
```
## EasyOCR
```python
import easyocr
reader = easyocr.Reader(["en", "es"], gpu=True)
results = reader.readtext("scan.jpg", detail=1, paragraph=False)
for bbox, text, conf in results:
print(conf, text)
# Paragraph mode groups lines
paragraphs = reader.readtext("scan.jpg", paragraph=True)
```
## PaddleOCR
```python
from paddleocr import PaddleOCR
ocr = PaddleOCR(use_angle_cls=True, lang="en", use_gpu=True, show_log=False)
result = ocr.ocr("scan.jpg", cls=True)
for line in result[0]:
bbox, (text, conf) = line
print(conf, text)
# PP-Structure for tables + layout
from paddleocr import PPStructure
structure = PPStructure(table=True, ocr=True, show_log=False)
layout = structure("page.png")
for region in layout:
print(region["type"], region["bbox"])
```
## AWS Textract (Sync + Async)
```python
import boto3
textract = boto3.client("textract", region_name="us-east-1")
# Sync - single page image/PDF <= 5MB
with open("scan.png", "rb") as f:
resp = textract.detect_document_text(Document={"Bytes": f.read()})
lines = [b["Text"] for b in resp["Blocks"] if b["BlockType"] == "LINE"]
# Async - multi-page PDFs in S3
start = textract.start_document_analysis(
DocumentLocation={"S3Object": {"Bucket": "docs", "Name": "big.pdf"}},
FeatureTypes=["TABLES", "FORMS"],
)
job_id = start["JobId"]
import time
while True:
status = textract.get_document_analysis(JobId=job_id)
if status["JobStatus"] in ("SUCCEEDED", "FAILED"):
break
time.sleep(5)
```
## Azure Document Intelligence
```python
from azure.ai.documentintelligence import DocumentIntelligenceClient
from azure.core.credentials import AzureKeyCredential
import os
client = DocumentIntelligenceClient(
endpoint=os.environ["AZURE_DOC_INTEL_ENDPOINT"],
credential=AzureKeyCredential(os.environ["AZURE_DOC_INTEL_KEY"]),
)
with open("invoice.pdf", "rb") as f:
poller = client.begin_analyze_document(
model_id="prebuilt-read", # or prebuilt-layout, prebuilt-invoice, ...
body=f,
)
result = poller.result()
for page in result.pages:
for line in page.lines:
print(line.content)
```
## Google Document AI
```python
from google.cloud import documentai_v1 as documentai
client = documentai.DocumentProcessorServiceClient()
name = "projects/my-proj/locations/us/processors/abc123"
with open("scan.pdf", "rb") as f:
raw = documentai.RawDocument(content=f.read(), mime_type="application/pdf")
request = documentai.ProcessRequest(name=name, raw_document=raw)
result = client.process_document(request=request)
doc = result.document
print(doc.text[:500])
for page in doc.pages:
for paragraph in page.paragraphs:
segment = paragraph.layout.text_anchor.text_segments[0]
print(doc.text[int(segment.start_index):int(segment.end_index)])
```
## Anthropic Claude Vision for OCR
```python
import anthropic
import base64
from pathlib import Path
client = anthropic.Anthropic()
def claude_ocr(image_path: str) -> str:
data = base64.standard_b64encode(Path(image_path).read_bytes()).decode()
media_type = "image/png" if image_path.endswith(".png") else "image/jpeg"
response = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=4096,
messages=[{
"role": "user",
"content": [
{"type": "image", "source": {
"type": "base64", "media_type": media_type, "data": data,
}},
{"type": "text", "text": (
"Transcribe all text from this image exactly as it appears. "
"Preserve line breaks, tables as markdown, and mark unreadable "
"text as [UNCLEAR]. Do not summarize or paraphrase."
)},
],
}],
)
return response.content[0].text
```
Strengths: excellent on messy handwriting, tables, mixed layouts. Weaknesses: slower, token cost, occasional hallucination (mitigate with strict prompt).
## Hybrid Pipeline (fast + accurate fallback)
```python
def ocr_with_fallback(image_path: str, conf_threshold: int = 70) -> str:
data = pytesseract.image_to_data(Image.open(image_path),
output_type=pytesseract.Output.DICT)
confs = [int(c) for c in data["conf"] if c != "-1"]
avg = sum(confs) / max(len(confs), 1)
if avg < conf_threshold:
return claude_ocr(image_path)
return pytesseract.image_to_string(Image.open(image_path))
```
## Anti-Patterns
| Anti-Pattern | Fix |
|---|---|
| OCR on born-digital PDFs | Try text extraction first, OCR only on failure |
| Tesseract on unpreprocessed scans | Deskew, denoise, binarize before OCR |
| Default PSM 3 for forms | Use PSM 6 or 11 depending on layout |
| Ignoring confidence scores | Flag low-conf pages for human or LLM re-OCR |
| No language pack specified | Pass `lang="eng+fra"` for multilingual docs |
| Using vision LLM for all pages | Use it only as fallback - it is expensive |
## Production Checklist
- [ ] Language packs installed for target locales
- [ ] Preprocessing pipeline (deskew, denoise, binarize)
- [ ] Confidence threshold triggers fallback to cloud/LLM OCR
- [ ] Async API used for multi-page documents
- [ ] Cost monitoring per page (Textract, Azure, Claude)
- [ ] PII detection after OCR (SSN, credit cards, etc.)
- [ ] Page-level caching keyed by image hash
- [ ] Dead-letter queue for OCR failures
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · claude-dev-suite/claude-dev-suite | 100 | MIT |
| spencermarx/open-code-review | 100 | Apache-2.0 |
| henkisdabro/wookstar-claude-plugins | 95 | MIT |
| adiroy911/scholarocr | 86 | MIT |
Database snapshot: 13.11.2026 · package version 46d94b66554a (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100media-ocr-ai
Modern AI OCR with open-source + commercial-safe models: PaddleOCR (Apache 2.0, Baidu, 80+ languages, layout analysis, tables), EasyOCR (Apache 2.0, JaidedAI, 80+ languages, easiest install), Tesseract 5 (Apache 2.0, mature LSTM backend, 100+ languages), TrOCR (MIT, Microsoft… - 100pdf-ocr
Extract text from scanned PDFs using optical character recognition. Use when a user asks to OCR a PDF, read a scanned document, extract text from an image PDF, digitize a scanned file, convert a scanned PDF to text, or read text from a photograph of a document. Supports multiple… - 100pdf
Use when working with PDF files. Covers text and table extraction, merging and splitting, form filling, watermarking, OCR for scanned documents, and generating PDFs. Trigger on "extract the tables from this pdf", "merge these pdfs", "fill out this pdf form", "ocr this scanned… - 100table-extraction
Table extraction from PDFs and images for RAG. Covers Camelot, Tabula, pdfplumber, TableTransformer (DETR), Amazon Textract Tables, Azure Document Intelligence. Conversion to markdown/CSV/JSON, merged-cell handling. USE WHEN: user mentions "table extraction", "PDF tables",… - 100neqsim-pdf-ocr
OCR-based text extraction from PDFs (scanned documents, P&IDs, vendor datasheets, engineering drawings) using OCRmyPDF, Tesseract, and pytesseract. USE WHEN: a PDF has no embedded text layer (scanned), pymupdf returns empty/low text, or the user explicitly asks to extract… - 90paddleocr-expert
Expert guide for PaddleOCR, PaddleX, PP-OCRv5, PP-StructureV3, PP-ChatOCRv4, table recognition, and PaddleOCR-VL. Use this skill when the user asks about OCR, PDF parsing, Markdown/JSON/XLSX export, model or pipeline selection, service deployment, hardware compatibility, PaddleX…