0

CODE:

const tesseract = require("node-tesseract-ocr");

const config = {
    lang: "eng",
    oem: 1,
    psm: 3,
};

tesseract
.recognize("https://tesseract.projectnaptha.com/img/eng_bw.png", config)
.then((text) => {
    console.log("Result:", text);
})
.catch((error) => {
    console.log(error.message);
});

ERROR:

Command failed: tesseract stdin stdout -l eng --oem 1 --psm 3
read_params_file: Can't open 1
read_params_file: Can't open -psm
read_params_file: Can't open 3
Tesseract Open Source OCR Engine v3.02 with Leptonica
Cannot open input file: stdin

ADDITIONAL INFORMATION:

  • Platform: Windows 11
  • Node Version: v18.12.1
  • Tesseract Version: 3.02

I am trying to extract text from images using NodeJS but getting this error what I am doing wrong here?

Is there any other reliable library available for extracting text from images?

2 Answers 2

1
  1. tesseract will not work on a captcha.
  2. you use archaic tesseract, but commands for the current version of the tesseract.
Sign up to request clarification or add additional context in comments.

Comments

1

Check if the installation is correct, type in a terminal "tesseract", if you get an error: Check if the environments variables are correct:

  1. Name: TESSDATA_PREFIX value: C:\Program Files\Tesseract-OCR\tessdata
  2. Name: tesseract value: C:\Program Files\Tesseract-OCR\tesseract.exe
  3. In PATH variable add C:\Program Files\Tesseract-OCR

if you are using VSCode to run the script, restart the window (that works for me).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.