@napi-rs/system-ocr
v1.2.0
Published
OCR via system provided API
Readme
@napi-rs/system-ocr
OCR library that uses system provided API.
VisionKiton macOS,Media OCRon Windows.
Example
node example/index.js| Example | Result |
| ---------------------------- | --------------------------- |
|
|
|
|
|
|
Usage
Install
pnpm add @napi-rs/system-ocr
yarn install @napi-rs/system-ocr
npm install @napi-rs/system-ocrAPI
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:
