Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/snapre/macos-ocr.js
macOS OCR ability js interface
https://github.com/snapre/macos-ocr.js
Last synced: 3 months ago
JSON representation
macOS OCR ability js interface
- Host: GitHub
- URL: https://github.com/snapre/macos-ocr.js
- Owner: snapre
- Created: 2022-12-11T10:23:09.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-15T14:57:01.000Z (about 2 years ago)
- Last Synced: 2024-04-25T19:42:39.379Z (9 months ago)
- Language: Swift
- Size: 64.5 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WIP macos-ocr.js
[![NPM version][npm-image]][npm-url]
[![CI][ci-image]][ci-url]
[![Test coverage][codecov-image]][codecov-url]
[![node version][node-image]][node-url]
[![npm download][download-image]][download-url][npm-image]: https://img.shields.io/npm/v/macos-ocr.js.svg?logo=npm
[npm-url]: https://npmjs.org/package/macos-ocr.js
[ci-image]: https://github.com/snapre/macos-ocr.js/actions/workflows/ci.yml/badge.svg
[ci-url]: https://github.com/snapre/macos-ocr.js/actions/workflows/ci.yml
[codecov-image]: https://img.shields.io/codecov/c/github/snapre/macos-ocr.js.svg?logo=codecov
[codecov-url]: https://codecov.io/gh/snapre/macos-ocr.js
[node-image]: https://img.shields.io/badge/node.js-%3E=_12-green.svg?logo=node.js
[node-url]: http://nodejs.org/download/
[download-image]: https://img.shields.io/npm/dm/macos-ocr.js.svg?logo=npm
[download-url]: https://npmjs.org/package/macos-ocr.js> Powered by https://developer.apple.com/documentation/vision/vnrecognizetextrequest
## Quick start
```bash
$ npm i macos-ocr.js -g$ ocr path/to/image.png
```
```js
// result
[
{
word: 'Hello world',
rect: { left: 126, top: 54, width: 326, height: 60 },
confidence: 0.5
},
...
]
```## Build swift project
```bash
bash ./scripts/build.sh
```## Run sample
```bash
node ./sample/ocr.js
```## Installment
```bash
$ npm i macos-ocr.js --save
```## Usage
```js
const { macosOcr } = require('macos-ocr.js');
const path = require('path');(async function main() {
const result = await macosOcr({
imageUrl: path.join(__dirname, 'img.png'),
});
console.log(result);
})();```
```js
// result
[
{
word: 'Hello world',
rect: { left: 126, top: 54, width: 326, height: 60 },
confidence: 0.5
},
...
]
```