---
title: "The oneocr command line"
url: https://recursiveai.org/oneocr/cookbook/command-line/
description: "Read images from a shell or a script with the oneocr tool: text to stdout, or a folder of pages to .txt and .page.json files."
version: "1.0.0"
---

# The oneocr command line

Read images from a shell or a script with the `oneocr` tool: text to stdout, or a folder of pages to `.txt` and `.page.json` files.

```shell
dotnet tool install --global RecursiveAI.OneOcr.Tool --version 1.0.0
```

One image prints its text:

```shell
$ oneocr ocr --in scans/receipt.png
Corner Market
1402 Oak Street
78704 Austin
+1 512 555 0142
Date: 24/10/2026
Time: 14:32
Coffee beans	12.99
2x Oat milk	8.98
Bagels	5.25
Subtotal	27.22
Tax 8.25 %	2.07
TOTAL	$ 29.29
Paid by	Card **** 4821
Thank you!
```

A folder writes one `.txt` per image, and `--json` adds the page model as `oneocr.page` JSON. `--degree` caps the threads, and the output doesn’t depend on it:

```shell
$ oneocr ocr --in scans/ --out text/ --json
$ oneocr ocr --in scans/ --out text-1/ --json --degree 1
$ ls text/
invoice.page.json
invoice.txt
receipt-photo.page.json
receipt-photo.txt
receipt.page.json
receipt.txt
$ diff -r text/ text-1/ && echo identical
identical
```

- `ocr` reads PNG and JPEG with the bundled models and never touches the network. `--model` and `--detector` read your own model files instead, and `--stats <file>` writes load time, time per page and peak memory as JSON.
- The same tool fine-tunes models on your own documents (`train`, `eval`, `review export`, `review import`); `oneocr help` lists every option, and the [review queue](https://recursiveai.org/oneocr/docs/review-queue/) describes the work directory.
- The tool is NativeAOT-clean; publishing it ahead of time gives fast starts in scripts (see the [overview](https://recursiveai.org/oneocr/docs/overview/#nativeaot)).
