Search code examples
tesseract

image file not found using command prompt and Tesseract (windows build from UB Mannheim)


I am a beginner in programming, and I have a project involving the use of tesseract. I added my tesseract folder to the build path to use it, I tested it with a common prompt to see the options offered by the program:

C:\Users\Asus_01>tesseract --help

And it does work.

Now, I add an image in that very same tesseract folder, the famous eurotext.png file (it's a 100% sure readable file for tesseract). I enter the the following command prompt:

tesseract eurotext.png out

As the image is in the very same directory as the tesseract.exe it should be no problem right?

I get this message:

C:\Users\Asus_01>tesseract eurotext.png out
Tesseract Open Source OCR Engine v3.05.01 with Leptonica
Error in fopenReadStream: file not found
Error in findFileFormat: image file not found
Error during processing.

Same problem if I try to indicate the exact path for the image:

C:\Users\Asus_01>tesseract C:\Users\Asus_01\Documents\Tesserac OCR project pack\
Tesseract-OCR\eurotext.png out

It is really frustrating because I found no hints of the reason why by searching on stackoverflow. I guess it's a simple mistake. Anyone?


Solution

  • Based on your command, the image file should be in the current directory, which is C:\Users\Asus_01>, not Tesseract installation directory. When you specify the full path to the image, if the path contains space characters, it will need to be in quotation marks, such as:

    C:\Users\Asus_01>tesseract "C:\Users\Asus_01\Documents\Tesserac OCR project pack\ Tesseract-OCR\eurotext.png" out