ocrs: a Rust OCR engine built around ONNX models and the RTen runtime
Rust library and CLI tool for OCR (extracting text from images)
At a glance
- What is it?
- ocrs is a Rust library and CLI for extracting text from images, aimed at developers who want an OCR engine that compiles to WebAssembly and is trained on openly licensed data. It is an early preview with Latin alphabet support only, so it is a fit for experimentation and embedding, not for production document pipelines yet.
- Who is it for?
- Adopt ocrs if you are building a Rust application or a WebAssembly target that needs Latin-script text extraction and you are comfortable with an early preview that the README says will produce more errors than commercial engines. Do not adopt it if you need non-Latin scripts, since the README states only the Latin alphabet is recognized today, or if you need a mature accuracy baseline.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 3 days ago.
- What is it written in?
- Mainly Rust, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE ANALYSIS
The preprocessing burden ocrs is trying to remove
Older OCR engines such as Tesseract, which the README names directly, tend to need image cleanup before they perform well: deskewing, thresholding, denoising, resolution fixes. That work is often the larger part of an OCR integration, and it is brittle because every new image source needs its own tuning. ocrs states its goal as working well on scanned documents, photos containing text and screenshots with zero or much less preprocessing, and it attributes that to using machine learning more extensively in the pipeline. The intended audience is therefore developers who have images of unpredictable origin and do not want to maintain a preprocessing stack in front of the recognizer. A second stated goal, an easy-to-compile codebase that runs on many platforms including WebAssembly, points at a different audience again: people shipping OCR inside a browser or an embedded Rust binary rather than behind a Python service.
PyTorch training, ONNX export, RTen execution
The architecture is stated plainly in the README. Models are written in PyTorch, exported to ONNX, and executed with RTen, a separate inference engine by the same author. Training and dataset tooling live in a separate repository, ocrs-models, which also publishes the models in ONNX format so they can be run by other machine learning runtimes. That separation matters for evaluation: the CLI and library repository is the consumer of the models, and the accuracy of a given ocrs version depends on which model artifacts it pulls. The CLI downloads those models on first run and stores them in ~/.cache/ocrs. The repository layout reflects the split between ML and non-ML code, since the README describes unit tests for the code that runs before and after model processing, with E2E tests covering the whole pipeline including the models. That is a useful signal about where bugs are likely to sit: the deterministic glue around the model is unit-tested, while recognition quality is only exercised end to end.
Installing the CLI and the commands it actually accepts
The README gives a Cargo install path. You need Rust and Cargo first, then `cargo install ocrs-cli --locked`. Clipboard input is behind a feature flag, so `cargo install ocrs-cli --locked --features clipboard` is the variant that enables it. Basic recognition is `ocrs image.png`. Reading from the system clipboard is `ocrs --clipboard` or the short form `ocrs -c`. Output redirection uses `-o`: `ocrs image.png -o content.txt` writes plain text, and `ocrs image.png --json -o content.json` writes text plus layout information as JSON. There is also an annotation mode, `ocrs image.png --png -o annotated.png`, which renders the location of detected words and lines onto an image. That JSON and annotation output is the part worth noting for integration work, because it exposes word and line geometry rather than only a flat string. For local development the README suggests cloning the repository and running `cargo run -p ocrs-cli -r -- image.png`.
Latin alphabet only, and an accuracy caveat from the README
The status section is unusually direct: ocrs is in early preview, and the README says to expect more errors than commercial OCR engines. Language support is limited to the Latin alphabet, with English given as the example, and broader language support is listed as planned rather than present. Anyone with Chinese, Arabic, Devanagari or Cyrillic documents is outside the supported set today, and no timeline is given. The second limitation is subtler. Because models are downloaded on first run into ~/.cache/ocrs, an offline or air-gapped deployment needs those artifacts placed in advance, and the README does not describe a flag for pointing at a local model directory. The third is that accuracy claims are not made anywhere in the supplied material. There are no benchmark tables, no character error rates, no comparison against Tesseract on a named dataset. You cannot size the accuracy gap from this repository alone; you have to measure it on your own images.
Where Tesseract still wins, and where ocrs differs
Tesseract is the obvious comparison because ocrs names it as the earlier engine it is reacting to. The difference in approach is where machine learning sits. Tesseract's pipeline has historically relied on classical image processing and a trained model at the recognition stage, which is why the README frames preprocessing effort as the thing being reduced. ocrs pushes learning further up the pipeline so that skewed photos and screenshots can go in with less cleanup. The trade is control and predictability. Tesseract is a mature project with trained data for a large number of scripts and a long history of tuning knobs; ocrs supports Latin only and is self-described as an early preview. If your documents are clean scans in a non-Latin script, Tesseract is the more appropriate tool and the preprocessing argument does not apply to you. If your inputs are messy Latin-script screenshots and you want a Rust dependency rather than a C++ one, the comparison reverses.
Build, test and upgrade costs in a Rust workspace
The maintenance picture is shaped by the split repository. Code changes are checked with `make check`, which the README describes as running unit tests and lint checks, and `cargo test` works directly as well. End-to-end tests need `make test-e2e` because they exercise the models, which means a full accuracy regression run requires model artifacts rather than just a compiler. Upgrades therefore have two moving parts: the crate version and the model version it downloads. A model swap can change recognition output without any code change in your project, which is a different upgrade profile from a pure library. The `--locked` flag in the install command pins dependency resolution at install time, which is a reasonable default for reproducible builds but does not pin the models. The README does not mention a lockfile or checksum mechanism for model downloads, so that is a gap worth verifying yourself.
Apache-2.0 for the code, and a separate question for the models
The repository is licensed Apache-2.0, which permits commercial use, modification and redistribution provided the licence and notices are preserved and any modified files carry prominent change notices. The README's stated goal of training on open and liberally licensed datasets is a deliberate design constraint, but the licence of the code and the licence of the downloaded model artifacts are two different things. The models live in the ocrs-models repository, and the supplied material does not state their licence terms. If you plan to redistribute models inside a product, or to ship a binary that fetches them, check the ocrs-models repository for the applicable terms before you rely on the Apache-2.0 label here. This is a factual gap in the material, not a legal opinion, and it is the kind of detail that is easy to miss when a project looks permissively licensed at the top level.
Editorial conclusion
Adopt ocrs if you are building a Rust application or a WebAssembly target that needs Latin-script text extraction and you are comfortable with an early preview that the README says will produce more errors than commercial engines. Do not adopt it if you need non-Latin scripts, since the README states only the Latin alphabet is recognized today, or if you need a mature accuracy baseline. Before committing, run `ocrs image.png --json -o content.json` on a sample of your own images and inspect the per-word layout output, then check the ocrs-models repository for how the models are trained and evaluated.
Community notes