Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

glyphly

OCR for Python with nothing to install but the package. Reads scans, photos and images into text, with every word's position and confidence. No Tesseract, no OpenCV, no system programs: pip install glyphly brings NumPy, Pillow and ONNX Runtime, all as wheels for Windows, macOS and Linux.

Pre-alpha. The engine works and is measured, but the API may change and it is not on PyPI yet. Feedback is very welcome.

import glyphly

page = glyphly.read("scan.png")  # path, bytes, PIL image or NumPy array
print(page.text)  # lines in reading order
print(page.confidence)  # 0..1, character-weighted
for word in page.lines[0].words:
    print(word.text, word.box, word.confidence)  # box = (x0, top, x1, bottom) in pixels
glyphly read scan.png            # text
glyphly read scan.png --json     # lines, words, boxes, confidences
glyphly download                 # fetch the model files now, for offline use later

For many images, create one glyphly.Reader() and call reader.read(...) on each: the models load once.

How it works

  1. Find text lines. A small segmentation network (PP-OCRv6 detection) marks text pixels. glyphly's own post-processing, written in NumPy, groups them into lines and measures each line's direction, so tilted pages (skewed scans, phone photos) are cut out straight instead of slicing through neighbouring lines.
  2. Read each line. A recognition network (PP-OCRv6) reads each straightened line at its full width (no width cap, so long lines and wide fonts are not squeezed), and CTC decoding turns its output into characters.
  3. Locate words. Each character comes from a known column of the line, so every word gets its own box on the page.

The model files (31 MB) are downloaded once into ~/.cache/glyphly (or GLYPHLY_HOME) and checked against a pinned SHA-256 fingerprint before use. They come from PaddleOCR via the RapidOCR project, both Apache-2.0 (see NOTICE). Replacing the recognition model with one trained by this project is on the roadmap.

Accuracy

Measured with bench/ocr.py on pages rendered from known text in 5 fonts, so the ground truth is exact. Held-out test split (pages never used while building), character error rate, lower is better:

glyphly gleanly + Tesseract RapidOCR (same models) plain Tesseract
Standard: clean, fax, blur, noise, 3° skew, JPEG, faint + shadow, phone photo (120 pages) under 0.05% 0.6% 5.1% 16.1%
Hard: small print, white on dark, colour, perspective, cheap scan, two columns, table (105 pages) 0.1% 0.0% 15.1% 0.5%

Two columns are read one after the other and tables row by row (each row on one line). Weak spot left on the hard suite: cheap scans (0.3%). These are generated pages: real scans and a comparison with docTR, EasyOCR, PaddleOCR and a paid OCR service come next (see docs/review.md).

Languages

glyphly.read() works out the script by itself: Latin-script languages, Chinese and Japanese are read by the default model; lines that look misread are re-read with the matching script model (downloaded the first time a page needs it, about 8 MB each, checked by SHA-256), right-to-left lines are put in reading order, and numbers skipped by the Arabic-script model are read back in. Or choose: Reader(lang="ru"), Reader(lang=["hi", "en"]), glyphly read scan.png --lang ar; glyphly download --all fetches every model for offline use.

Measured with bench/languages.py (the same short notice with a date and an amount, written in each language and drawn by a browser so every script is shaped correctly), character error rate:

Script Languages measured CER
Latin English, German, French, Spanish, Portuguese, Polish, Turkish 0%
Latin Vietnamese 5.4% (stacked accents dropped)
Chinese, Japanese, Korean zh, ja, ko 0%
Greek, Thai, Tamil el, th, ta 0%
Cyrillic Russian, Ukrainian 5.0%, 1.2%
Devanagari, Telugu Hindi, Telugu 1.4%, 4.2%
Arabic script Arabic, Persian 5.3%, 6.3%
Not supported yet Hebrew, Armenian, Georgian (no open model yet) 83% (Hebrew)

Average over the 20 languages measured this way: 1.4%. One sentence per language is a smoke test, not a full benchmark.

Indian scripts read word by word (new in 0.2). Malayalam, Bengali, Assamese, Kannada, Gujarati, Gurmukhi (Punjabi) and Odia have no open line recognizer, so glyphly cuts each line into words and reads them with IndicPhotoOCR's word recognizers (converted to ONNX, about 35 MB each, downloaded on first use). Name the language to use them: Reader(lang="ml"), Reader(lang=["auto", "bn"]) for pages mixing Bengali with English, or glyphly read scan.jpg --lang ml. Auto mode does not pick them by itself yet: a word model reads any script with high confidence (Malayalam's reads Hebrew and English lines at 0.84-0.97), so its confidence cannot tell which script a line is in. A small script identifier that looks at the line image is being built for that. Measured on real scanned book pages from Wikisource (bench/real.py, human-proofread text, 12 pages each, language named), median character error:

Language Before (0.1) glyphly 0.2
Bengali 87% 12%
Assamese not readable 14%
Malayalam (many 18th-19th century books) 92% 26%
Punjabi not readable 28%

Real scans are much harder than drawn text (old typefaces, worn paper, page furniture the transcriptions leave out), so these numbers are not comparable with the table above.

Status and roadmap

  • Engine on ONNX Runtime with no system dependencies; rotated lines; word boxes
  • Held-out and hard-suite results; two-column reading order; table rows
  • 20 languages in 11 scripts, detected automatically
  • Seven more Indian scripts (Malayalam, Bengali, Assamese, Kannada, Gujarati, Gurmukhi, Odia), read word by word
  • Page orientation (sideways, upside down); real-scan benchmark in 34 languages
  • Released on PyPI; gleanly's OCR engine
  • Table structure (cells); Hebrew, Armenian, Georgian; better Arabic on old prints
  • glyphly's own trained recognition model
  • Real-scan benchmark; comparison with Docling, Marker and a paid OCR service

Development

uv sync                      # package + dev tools
uv run glyphly download      # model files
uv run pytest
uv sync --group bench        # + RapidOCR baseline; gleanly[ocr] and Tesseract optional
uv run python -m bench.ocr --split dev

License

Apache-2.0. See LICENSE and NOTICE.

Metadata

Release files for glyphly 0.2.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for glyphly 0.2.0a1
File Size Uploaded Provenance Actions
glyphly-0.2.0a1.tar.gz 57.7 kB With provenance Details for glyphly-0.2.0a1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for glyphly 0.2.0a1
File Interpreter ABI Platform Actions
glyphly-0.2.0a1-py3-none-any.whl Python 3 none any Details for glyphly-0.2.0a1-py3-none-any.whl

Total release size: 93.2 kB

Release files / glyphly-0.2.0a1.tar.gz

Download URL glyphly-0.2.0a1.tar.gz
Size 57.7 kB
Tags Source
SHA-256 checksum
How to use checksums
537f721f1b8ab6a2e7e900a38002fcbf65842a656a2dc5330b1dcf23b25bbe37
BLAKE2b-256 checksum
How to use checksums
4e62d61c470ab2dc29e8998d9a8f563a63fc80aabeb66a0f7205604446550d7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / glyphly-0.2.0a1-py3-none-any.whl

Download URL glyphly-0.2.0a1-py3-none-any.whl
Size 35.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8fb18d2df1aad67e16c8be5a5532cceeb1d21523f925cc12e56142e08dbff6f
BLAKE2b-256 checksum
How to use checksums
980dc2693666ec5563e1d059caac4e4f8786280d3d397f591f3532c6fdc9d2d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for glyphly 0.2.0a1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for glyphly-0.2.0a1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page