ocr

Extract text from images using pytesseract and Pillow.

1.6k|289|Updated May 14, 2025
One-click install
npx skills add https://github.com/trpc-group/trpc-agent-go --skill ocr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ocr
Source: https://github.com/trpc-group/trpc-agent-go/tree/main/examples/skill/skills/ocr
Command: npx skills add https://github.com/trpc-group/trpc-agent-go --skill ocr

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pytesseract, Pillow, requests, and includes scripts (resource) components.

What problem does it solve?

This skill automates the extraction of text from images, removing the tedious manual transcription step and enabling rapid data capture.

Core Features & Use Cases

  • Language support and multi-format input: OCR on PNG/JPG/JPEG/GIF/BMP/TIFF/WEBP with multi-language capability.
  • Preprocessing for accuracy: Optional image preprocessing (grayscale, contrast, sharpening) to improve results.
  • Output formats: Plain text or JSON with confidence scores for downstream analytics.
  • Use Case: Digitize receipts, scanned documents, or research images to extract searchable text.

Quick Start

Basic local OCR: python3 scripts/ocr.py <image_file> <output_file> OCR with language: python3 scripts/ocr.py image.png text.txt --lang eng OCR from URL: python3 scripts/ocr_url.py "https://example.com/image.jpg" text.txt --lang eng

Frequently Asked Questions about ocr

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

FAQPage Schema
How do I extract text from images using Python for scanned documents?

You can extract text from images by running Python scripts that leverage pytesseract and Pillow, supporting local files and remote URLs to digitize scanned documents and receipts into plain text or JSON.

Can I run OCR on remote images from a URL without downloading them first?

Yes, you can perform OCR on remote images by executing the dedicated ocr_url.py script, which fetches images directly from a URL using requests and processes them without manual downloading.

Does pytesseract support multi-language text extraction from images?

Yes, pytesseract supports multi-language text extraction, allowing you to specify the target language via the --lang flag to accurately digitize research materials and international documents.

What image formats can I use for OCR text extraction?

You can process PNG, JPG, JPEG, GIF, BMP, TIFF, and WEBP image formats, applying optional preprocessing like grayscale and contrast adjustments to improve OCR accuracy on various scans.

How do I get confidence scores when extracting text from images?

To get confidence scores, you can configure the OCR script to output JSON format, which includes the extracted text alongside confidence metrics to support downstream data analytics and validation.

What is the best way to improve OCR accuracy on low quality scanned forms?

The best way to improve OCR accuracy on low quality scans is to apply optional image preprocessing, utilizing grayscale, contrast enhancement, and sharpening filters before running the text extraction.