OCR Skill
This skill provides stand‑alone OCR functionality without any Telegram or Discord bot integrations. It can be used by other agents via the core ocr_core.py module.
Features
- Supports JPG, PNG, WEBP.
- Languages: German (de) and English (en) (easy to extend).
- Uses EasyOCR as primary engine, falls back to Tesseract when needed.
- Optional pre‑processing (grayscale, contrast‑enhancement) for noisy scans.
- Fully async – multiple simultaneous requests are handled without blocking.
- Clean error handling & logging.
Structure
ocr/
├─ SKILL.md # this file
├─ HEARTBEAT.md # optional periodic health check
├─ package.json # metadata for ClawHub
├─ main.py # optional entry‑point (can be omitted)
├─ ocr_core.py # core OCR logic, importable by other agents
├─ ocr_engine.py # wrapper for EasyOCR/Tesseract
└─ utils.py # download / cleanup helpers
Setup & Deployment
- Install system dependencies – Tesseract is required for the fallback engine:
sudo apt-get update && sudo apt-get install -y tesseract-ocr libtesseract-dev # Debian/Ubuntu # or on macOS: brew install tesseract - Create a virtual environment (recommended):
cd /root/.openclaw/workspace/ocr python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt - Start the skill – you can run the optional entry point if you need a simple CLI:
Or import the core directly from other agents:python -m ocr.mainfrom ocr.ocr_core import OCR text = OCR().process_image("/path/to/image.jpg") - Test – call the core function with any supported image file and verify the extracted text.
