Skip to content

About

Ocr api via system API

Resources

Stars

116 stars

Watchers

1 watching

Forks

Repository files navigation

@napi-rs/system-ocr

https://github.com/Brooooooklyn/system-ocr/actions

OCR library that uses system provided API. VisionKit on macOS, Media OCR on Windows.

Example

node example/index.js
Example Result
example result
example result

Usage

Install

pnpm add @napi-rs/system-ocr
yarn install @napi-rs/system-ocr
npm install @napi-rs/system-ocr

API

import { recognize } from '@napi-rs/system-ocr'

const result = await recognize('path/to/image.png')

for (const line of result.lines) {
  console.log(line.text, line.confidence, line.boundingBox)
}

result.lines follows the system OCR engine's reading order. Each bounding box uses normalized input-image coordinates (0 to 1) with its origin at the top-left. The formatted result.text is preserved for compatibility and is not guaranteed to equal the line texts joined together. Line confidence is 1.0 on Windows, matching the existing result confidence convention.

import { recognize, OcrAccuracy } from '@napi-rs/system-ocr'

const image = await fetch('https://example.com/image.png')

const result = await recognize(image, OcrAccuracy.Accurate, ['fr', 'zh-cn'])

Credits

Huge thanks to:

About

Ocr api via system API

Resources

Stars

116 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages