https://github.com/vrajvyas11/easyocr-js
easyocr-js is a lightweight wrapper for EasyOCR that enables seamless text recognition in JavaScript. It simplifies integration with EasyOCR's Python backend, allowing developers to perform OCR tasks effortlessly in JS environments.
https://github.com/vrajvyas11/easyocr-js
easyocr ocr optical-character-recognition wrapper
Last synced: 3 months ago
JSON representation
easyocr-js is a lightweight wrapper for EasyOCR that enables seamless text recognition in JavaScript. It simplifies integration with EasyOCR's Python backend, allowing developers to perform OCR tasks effortlessly in JS environments.
- Host: GitHub
- URL: https://github.com/vrajvyas11/easyocr-js
- Owner: VrajVyas11
- Created: 2025-03-07T16:56:21.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-27T10:18:21.000Z (over 1 year ago)
- Last Synced: 2025-03-27T11:27:59.780Z (over 1 year ago)
- Topics: easyocr, ocr, optical-character-recognition, wrapper
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/easyocr-js
- Size: 2.29 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# easyocr-js
A Node.js wrapper for the Python EasyOCR library
## Description
easyocr-js is a lightweight Node.js wrapper for the EasyOCR Python library, allowing developers to perform Optical Character Recognition (OCR) in their Node.js applications with minimal setup. This package provides a simple interface to leverage EasyOCR's capabilities within JavaScript/TypeScript projects.
## Installation
```bash
npm install easyocr-js
```
### Prerequisites
- Python 3.6+ must be installed on your system.
- Pip package manager is required.
- The necessary Python dependencies will be installed automatically during the npm installation process.
## Usage
easyocr-js supports CommonJS module systems. Below is an example:
### Example
```javascript
const EasyOCRWrapper = require("easyocr-js");
(async () => {
const ocr = new EasyOCRWrapper();
console.log(await ocr.init("en"));
console.log(await ocr.readText("path/to/yourimage.jpg")); // Replace with actual image path
console.log(await ocr.close());
})();
```
## API
### `init(languages: string): Promise`
Initializes the OCR reader with the specified languages.
- `languages`: Comma-separated language codes (e.g., `'en,fr'`).
- Returns a Promise resolving to a status object.
### `readText(imagePath: string): Promise`
Performs OCR on the specified image.
- `imagePath`: Path to the image file.
- Returns a Promise resolving to an array of detected text objects:
```json
{
"status": "success",
"data": [
{
"bbox": [[x1, y1], [x2, y2]],
"text": "Detected text",
"confidence": 0.98
}
]
}
```
### `close(): Promise`
Closes the OCR reader and releases resources.
## Requirements
- Node.js 14.0.0 or higher
- Python 3.6 or higher
- Pip (Python package installer)
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Contributing
Contributions are welcome! Please submit a pull request with your improvements.
## Issues
If you encounter any bugs or have feature suggestions, please open an issue in the [GitHub repository](https://github.com/VrajVyas11/easyocr-js/issues).