Why does Tesseract CLI show 'cannot create output file' on Windows 7?

I have installed (Or at least I think I ran an installer) tessearct-ocr on my my machine running 64-bit Windows 7. I am trying to interact with the program through cmd. to convert a .png image to text.

I have tried

tesseract filename.png filename

and got the error message cannot create output file.

Does anyone know of a good tutorial that describes the various commands? I can't seem to find beginner based information in the documentation.

I would describe myself as a beginner user who is keen to learn how to use cmd to run commands.


Solution 1:

Was the command line formed right?

Looking at the tesseract-ocr documentation, this command is used on Windows:

tesseract <image> <outputbasename> [-l lang] [configs]

In command line syntax, the < and > characters mean that you need to specify the parameter,
the [ and ] characters indicate an optional parameter, the text in between describes the parameter.

So, it requires you to provide an image and an outputbasename:

  • image: Given this name, it should be a absolute or relative path to a supported file; from what I see JPEG, PNG and Tiff are supported, so filename.png here is fine.

  • outputbasename: Given this name, it's asking for a base which is most of the times a directory. But given the operation it would sound more logical to output text to a file than a directory unless you are going to output multiple files. So filename is fine if it's a base directory, but you could also try filename.txt just in case. Worst case it's going to create a directory called filename.txt! ;-)

From what I see, the commandline tesseract filename.png filename is just fine.

A site like Command Windows might be interesting if you want to learn more about the Command Prompt, from there you might me interested in Command Prompt References and Batch Script Tutorials.


Cool! But where does the error come from and how can I solve it?

Permission errors can be solved with Process Monitor, by filtering the statuses with ACCESS DENIED.

But, my guess here is that you can avoid that as I suspect an UAC error. Try running the command prompt as an administrator and try the command again in your user folder. If that doesn't work then try going trough Process Monitor and if that doesn't work then feel free to comment for more help... ;-)