This project is a simplest implementation of Tesseract.js library to transform image characters in text. This project is a server which receives a REST HTTP request with a image's path and transforms image's characters in text.
First, run the server and keep it listening to a local port to be able to transform images via REST communication.
- You MUST have Node.js v14 or later installed on your computer (Download it here).
- Open Command Prompt (Windows) or Shell (Linux or Mac) and run
npm install
on this folder to install all dependencies. - After installed, run
npm start
to start development server. - When the server gets ready and running, it will output
OCR Server is listening at port
(probably at port 3000).
Now the server is running and ready to receive REST calls and this is what we'll do now. I'm using Postman to make this Request:
- Install Postman.
- Import the
node-ocr-tesseract-demo.postman_collection.json
Postman workspace file. - Send the request and analyze the console output showing text data as text.
- You can change the
imageUrl
token to another supported image path (remote path or local path in the server).
I'm using Visual Studio Code to debug this project. So here's the way I'm doing:
- First of all, you must install Visual Studio Code if you don't have it yet.
- After installed, check if you can run the server as mentioned in the last tutorial above (installing Node.js, dependencies, etc).
- Everything needed to debug in VSCode I already wrote in
.vscode/launch.json
! =) - So just press F5 key (or go to
Debug > Start debugging
) to run the server in debug mode =)
Send me a pull request! =)
Thanks!