9951 explained code solutions for 126 technologies


tesseract-ocrHow do I install a language for Tesseract OCR?


  1. First, download the language data files for the language you want to use for Tesseract OCR. The language data files are available from the Tesseract OCR GitHub repository.

  2. Extract the language data files and move them to the tessdata directory of the Tesseract OCR installation. For example, if you are using Linux, the Tesseract OCR installation directory is usually located at /usr/share/tesseract-ocr/4.00/tessdata.

  3. To check if the language has been successfully installed, run the following command in the terminal:

tesseract --list-langs

Output example

List of available languages (3):
eng
osd
spa
  1. Now you can use the language you have installed to perform OCR on images. To do this, use the -l flag to specify the language you want to use:
tesseract image.png output -l eng
  1. You can also use the --print-parameters flag to check the language you have installed and other parameters that Tesseract OCR is using:
tesseract --print-parameters

Output example

Tesseract parameters:
  -l eng        Language: eng
  ...
  1. If you want to use multiple languages, you can specify them with the -l flag, separated by +:
tesseract image.png output -l eng+spa
  1. For more information about how to install and use languages for Tesseract OCR, see the Tesseract OCR documentation.

Edit this code on GitHub