How To
Use CLI
Command line interface usage, batch processing, and output formatting options for RustO!.
RustO! comes with a high-performance command line interface (CLI) binary for desktop OCR, terminal workflows, and automated CI pipelines.
Installation & Building
Build the CLI directly from source with Release optimizations:
cargo build --release
The compiled binary will be located at target/release/rusto. You can optionally install it into your $PATH:
cargo install --path .
1. Basic CLI Invocations
rusto --det-model models/det.rten --rec-model models/rec.rten --dict models/dict.txt receipt.jpg
2. CLI Options Reference
| Option | Flag | Type | Default | Description |
|---|---|---|---|---|
| Detection Model | --det-model | Path | Required | Path to DBNet detection model file (.rten or .onnx). |
| Recognition Model | --rec-model | Path | Required | Path to CTC recognition model file (.rten or .onnx). |
| Dictionary | --dict | Path | Required | Path to character vocabulary dictionary text file. |
| Output Format | -f, --format | Enum | json | Output mode (json, text, tsv, markdown, text-ordered). |
| Orientation | --enable-orient | Flag | false | Enable whole-document orientation detection. |
| Orient Model | --orient-model | Path | None | Path to LCNet document orientation model file (.rten or .onnx). |
3. Output Formats with Real Examples
1. JSON (--format json)
Outputs structured JSON with bounding polygon quads and axis-aligned bounding frames:
rusto --det-model det.rten --rec-model rec.rten --dict dict.txt --format json receipt.jpg
[
{
"text": "COFFEE SHOP",
"score": 0.992,
"box_points": [
[95.0, 30.0],
[275.0, 30.0],
[275.0, 55.0],
[95.0, 55.0]
],
"frame": {
"left": 95.0,
"top": 30.0,
"width": 180.0,
"height": 25.0
}
},
{
"text": "Total $16.50",
"score": 0.988,
"box_points": [
[40.0, 245.0],
[320.0, 245.0],
[320.0, 265.0],
[40.0, 265.0]
],
"frame": {
"left": 40.0,
"top": 245.0,
"width": 280.0,
"height": 20.0
}
}
]
2. Formatted Spatial Layout (--format text-ordered)
Preserves tabular columns, receipt rows, and document indentations:
rusto --det-model det.rten --rec-model rec.rten --dict dict.txt --format text-ordered invoice.jpg
Item Description Qty Price Total
Mechanical Keyboard 1 $120.00 $120.00
Wireless Mouse 2 $45.00 $90.00
USB-C Hub 1 $35.00 $35.00
──────────────────────────────────────────────────────
Total Amount: $245.00
3. Tab-Separated Values (--format tsv)
Ideal for shell scripting and piping into awk, cut, or spreadsheets:
rusto --det-model det.rten --rec-model rec.rten --dict dict.txt --format tsv receipt.jpg
COFFEE SHOP 0.992 95.0,30.0,275.0,30.0,275.0,55.0,95.0,55.0
2026-08-20 0.981 40.0,70.0,140.0,70.0,140.0,90.0,40.0,90.0
Total $16.50 0.988 40.0,245.0,320.0,245.0,320.0,265.0,40.0,265.0
4. Markdown Fenced Text (--format markdown)
rusto --det-model det.rten --rec-model rec.rten --dict dict.txt --format markdown receipt.jpg
COFFEE SHOP 2026-08-20 12:30 Espresso Double $4.50 Total $16.50
4. Shell Integration & Batch Processing
Piping into jq for JSON Processing
Extract high-confidence text lines:
rusto --det-model det.rten --rec-model rec.rten --dict dict.txt receipt.jpg | \
jq -r '.[] | select(.score > 0.95) | "\(.text) (\(.score * 100 | round)%)"'
Batch Scanning an Entire Directory
Scan all .jpg and .png images in parallel using xargs:
find ./scans -type f \( -name "*.jpg" -o -name "*.png" \) | \
xargs -I {} -P 4 rusto --det-model det.rten --rec-model rec.rten --dict dict.txt --format text-ordered {}