Search code examples
command-prompttesseract

How do I convert individual images within a folder to text with Tesseract, but keep them as individual files with the same name?


I'm aware how to use Tesseract the usual way with Command Prompt, using "tesseract (filename.extension) (filename.txt)". My issue is I have a large amount of images that need converted. I know you can use a batch file to combine the seperate images into one file of text, but I would like to keep them in individual files, with the same file names as they previously had. Is there a way to do this with Windows' Command Prompt, or would I need to use something like Python?

Thanks for the help.


Solution

  • e.g.:

     for /r %a in (*.png) do tesseract "%a" "%~na" -l eng