Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

oneocr

oneocr

Windows 11's built-in OCR engine, wrapped in pure Java — and a command line tool built on it.

Website · Live output · The 1ocr command


The Windows 11 Snipping Tool carries an undocumented ~50 MB Microsoft OCR model called OneOCR. It is fast, it is already on the machine, and it reads Latin, Devanagari and Tamil well. It has no public API.

These repositories bind it from Java through the Foreign Function & Memory API — no JNI, no native glue to compile — and build a command line tool on top that reads images, PDFs and whole folders, and writes text, JSON, SVG and a browser-renderable semantic XHTML that keeps every word's bounding box and confidence.

The work rests on the reverse-engineering of b1tg/win11-oneocr and others.

Repositories

Repository Maven artifact What it is
cli io.github.oneocr:oneocr-cli The 1ocr command — images, PDFs, folders, and the layout-aware export
api io.github.oneocr:oneocr-api The FFM binding to oneocr.dll. Use this to build your own tool
tesseract io.github.oneocr:oneocr-tesseract Optional Tesseract 5 second pass, for the scripts OneOCR cannot read
xhtml_controls_js io.github.oneocr:oneocr-xhtml_controls_js The viewer controls for that XHTML, written in Java and compiled to JS by TeaVM
semantic_xhtml The CSS and JS every generated document links, served over GitHub Pages

Quick start

1ocr page.png                     # txt, json, svg and semantic xhtml beside the input
1ocr pdf order.pdf --layout       # every page, plus a layout-aware text and html export
1ocr folder ./scans -r            # a whole tree, resumable
1ocr layout order.pdf.oneocr.xhtml   # re-render from saved boxes, no second OCR pass

Needs JDK 22+ (JDK 21 works with --enable-preview) and Windows 11.

Two things worth knowing

The native libraries are not distributed here. oneocr.dll, oneocr.onemodel, onnxruntime.dll and opencv_world*.dll are Microsoft components that ship with Windows. Take them from your own installation and drop them in api/src/main/resources/natives/.

Line order is not reading order. The engine reports lines in its own sequence, so a cause title set in two columns comes out interleaved. --layout recovers the real structure by recursive X-Y cutting over the line boxes and writes a parallel text and HTML rendering. On a real 83-page court notice it rejoined 145 orphaned fragments and unscrambled the table of contents.

Status

Windows only today. Linux is the next target, and C sources are expected alongside the Java.