For developers
OCR inside your own software.
Every word comes back as a typed object with its text, confidence and position; errors arrive as your language's exceptions. One loaded model serves many threads, and nothing calls out to the internet.
Libraries
A few lines in the language you use.
Ready wrappers for Python, .NET, Java, Node.js and Go over a small C API, with examples for each in the download.
from glyphwise import Glyphwise
with Glyphwise("models/line.bin") as ocr:
doc = ocr.read("scan.pdf", lang="fr")
for w in doc.words():
if w.confidence < 0.8:
print("check:", w.text, w.bbox)
using Glyphwise;
using var ocr = new GlyphwiseOcr("models/line.bin");
Document doc = ocr.Read("scan.pdf", lang: "de");
foreach (var w in doc.Words())
if (w.Confidence < 0.8)
Console.WriteLine($"check: {w.Text} {w.BBox}");
import site.glyphwise.*;
try (var ocr = new Glyphwise(Path.of("models/line.bin"))) {
Document doc = ocr.read(Path.of("scan.pdf"));
for (var w : doc.words())
if (w.confidence() < 0.8)
System.out.println("check: " + w.text());
}
const { Glyphwise } = require("glyphwise");
const ocr = new Glyphwise("models/line.bin");
const doc = ocr.read("scan.pdf", "es");
for (const w of doc.words())
if (w.confidence < 0.8) console.log("check:", w.text, w.bbox);
ocr.close();
ocr, err := glyphwise.Open("models/line.bin")
if err != nil { log.Fatal(err) }
defer ocr.Close()
doc, _ := ocr.ReadFile("scan.pdf", "it")
for _, w := range doc.Words() {
if w.Confidence < 0.8 { fmt.Println("check:", w.Text) }
}
Underneath is a C API (include/glyphwise.h) for anything else. Tables come back as typed
tables with a cell grid in every wrapper. Building it into an application is part of the
Developer licence.
What comes back
Every word with its box and confidence.
The same structure in JSON, in the wrappers' typed objects, and in hOCR and ALTO for archive systems. Boxes are in pixels of the image you passed in; PDF text layers are read directly and marked as such.
Reading order
Pages, blocks, lines and words, in the order a person reads them, with headers and footers marked.
Confidence you can act on
Route low-confidence words to a person and let the rest flow through.
Structured data too
Tables with rows, columns and cell boxes; form fields, checkboxes and barcodes on every page.
{
"engine": "line",
"source": "fw4-photo.png",
"units": "pixels",
"pages": [{
"page": 1, "width": 2550, "height": 3300,
"method": "ocr", "skew_degrees": 0.4,
"blocks": [{
"index": 0,
"lines": [{
"text": "OMB No. 1545-0074 2026",
"confidence": 0.87,
"words": [{
"text": "2026",
"confidence": 0.61,
"bbox": { "x": 2104, "y": 212,
"width": 168, "height": 58 }
}, ...]
}, ...]
}, ...],
"fields": [...], "checkboxes": [...], "barcodes": [...]
}]
}
An example, shortened: one word of one line, with the keys the JSON output uses.
Four ways to run it
From one folder of scans to your own application.
Desktop window
Drop files or folders on the window, tick the formats and convert. Nothing to configure.
glyphwise-gui
Command line and hot folder
Batch-convert folders in parallel, or watch a folder and read every file that appears. Add --gpu to use an NVIDIA card.
glyphwise models\line.bin scans ^ --out-dir out --formats pdf,docx,xlsx glyphwise models\line.bin --watch inbox --out-dir out
Local HTTP service
For your document system or scanner workflow. Loopback by default; tokens or named API keys when other machines call it.
glyphwise-server --model models\line.bin curl --data-binary @scan.pdf ^ "localhost:8080/ocr?format=alto"
Library
Python, .NET, Java, Node.js and Go wrappers, and the C API for anything else.
doc = ocr.read("scan.pdf")
print(doc.text)
HTTP service
One endpoint, every output.
Post the raw file bytes to /ocr; choose the result with query parameters.
/health lists the loaded languages and modes.
| Parameter | Values | What it does |
|---|---|---|
format | json (default), text, pdf, docx, xlsx, csv, fields, hocr, alto | The output written to the response. |
lang | en, fr, de, es, it, pt, nl, auto | The language model, or one chosen per page. |
mode | fast, accurate | Reads with the accurate model when the package has one. |
pdf_image | lossless, jpeg, bw, mrc | How the page image is stored in a searchable PDF. |
redact | all or email,ssn,phone,card,iban | Blacks out personal data in the response. |
Everything else, from licence files to the C API, is in the user guide.
Build it in this week.
The trial package includes the libraries, the examples and the HTTP service.