rustocr-0.6.0 is not a library.
RustOCR
A fast Rust CLI wrapper for EasyOCR providing OCR capabilities with 80+ language support.
Features
- 🚀 Fast CLI interface built with Rust
- 🌍 80+ languages supported (via EasyOCR)
- 🎯 GPU acceleration support (CUDA/MPS)
- 📊 Multiple output formats: JSON, text, detailed
- 🔧 Easy to use with sensible defaults
Prerequisites
Before using RustOCR, ensure you have:
-
Python 3.7+ installed
-
EasyOCR Python library:
Note: If you encounter import errors with EasyOCR (e.g.,
bidimodule issues), try reinstalling: -
Rust toolchain (for building from source):
|
Installation
Build from source
The binary will be available at target/release/rustocr.
Install system-wide (optional)
Usage
Basic Examples
# Simple OCR on an English image
# OCR with Chinese and English
# Use CPU instead of GPU
# Get simple text output (no bounding boxes)
# Detailed human-readable output
Command-Line Options
Options:
-i, --input <FILE> Input image file path
-l, --languages <LANGS> Languages to recognize (comma-separated) [default: en]
-g, --gpu <BOOL> Enable GPU acceleration [default: true]
-d, --detail <LEVEL> Detail level: 0 (text only) or 1 (full) [default: 1]
-o, --output <FORMAT> Output format: json, text, or detailed [default: json]
-h, --help Print help
-V, --version Print version
Supported Languages
EasyOCR supports 80+ languages including:
- Latin: English (en), French (fr), German (de), Spanish (es), Portuguese (pt), Italian (it), etc.
- Chinese: Simplified (ch_sim), Traditional (ch_tra)
- Japanese (ja), Korean (ko), Thai (th)
- Arabic (ar), Persian (fa), Urdu (ur)
- Cyrillic: Russian (ru), Ukrainian (uk), Bulgarian (bg), etc.
- Devanagari: Hindi (hi), Marathi (mr), Nepali (ne)
- And many more...
See thefull list of supported languages.
Output Formats
JSON (default)
Text
Hello World
Sample Text
Detailed
Text: Hello World
Confidence: 0.9872
Bounding Box: [[10, 20], [100, 20], [100, 50], [10, 50]]
Performance Tips
- GPU: For best performance, use GPU mode (default). Requires CUDA or MPS support.
- CPU: Use
-g falseif you don't have GPU support. Performance will be slower but still functional. - Batch Processing: For multiple images, call the binary in a loop or script.
Troubleshooting
"Failed to import easyocr"
Make sure EasyOCR is installed:
GPU-related errors
If you encounter GPU errors, try CPU mode:
"Input file does not exist"
Ensure the image path is correct and the file exists.
Architecture
RustOCR uses PyO3 to bridge Rust and Python, calling the EasyOCR library at runtime:
┌─────────────┐
│ Rust CLI │ (Argument parsing, error handling)
│ (clap) │
└──────┬──────┘
│
↓
┌─────────────┐
│ PyO3 │ (Rust ↔ Python bridge)
└──────┬──────┘
│
↓
┌─────────────┐
│ EasyOCR │ (Python library)
│ (PyTorch) │
└─────────────┘
License
Apache-2.0 (matching the parent EasyOCR project)