Open Source
Explore the latest AI open-source projects from GitHub and HuggingFace.
Explore the latest AI open-source projects from GitHub and HuggingFace.
light-ocr is an offline OCR runtime for Node.js and C++ built around PP-OCRv6 Small, aimed at the case where text recognition has to run inside an application rather than behind an API. Images, PDFs, and results stay on the machine. Every recognized line comes back with its text, a confidence score, and a quadrilateral box giving its position in the original image, with lines returned in reading order.
The distribution model is the part that separates it from most OCR packages. A single npm install @arcships/light-ocr carries the model, the OCR runtime, a PDFium build for page rendering, and a checksum-pinned Noto Sans SC fallback font, through the platform-specific dependency. There is no postinstall script, no first-run model download, no compiler requirement, and no separate PDF engine to install. The bundled Chinese fallback font matters in practice: PDFs that reference common non-embedded CJK fonts still render before OCR runs. CommonJS, ESM, and TypeScript are all supported across six prebuilt platforms.
Hardware acceleration is selected automatically. createEngine() runs in Auto mode, trying Core ML first on macOS 15+ Apple Silicon, WebGPU through Vulkan on Linux x64 with glibc, and WebGPU through D3D12 on Windows x64, falling back to CPU elsewhere — including macOS on Intel and both arm64 desktop targets. Recognition runs off the JavaScript main thread and supports queues, cancellation, and explicit cleanup, which is what makes it usable inside an Electron app or a request handler rather than only in a script.
Inputs cover JPEG, PNG, PDF, encoded bytes, and decoded pixel buffers in GRAY8, RGB8, BGR8, and RGBA8. recognizeDocument() streams PDF pages as an async iterator at a configurable DPI, or treats several images as one document. The bundled light-ocr CLI exposes the same surface — recognize, detect for boxes only, info, and doctor for hardware and provider diagnostics — with text, JSON, and streaming JSONL output under a versioned schemaVersion: 1 contract. EXIF orientation is corrected automatically, and an optional tiled mode preserves small, dense text in high-resolution scans.
Scope is worth being clear about: this is a recognition engine, not a document-understanding model — there is no layout reconstruction to Markdown or VLM reasoning over the page. Node.js 22 and 24 are the supported runtimes, and the project is at v0.5.7 (2026-08-05), so the API surface is still pre-1.0. Licensed Apache-2.0.