diff --git a/README.rst b/README.rst index f4bbf121..79f4755a 100644 --- a/README.rst +++ b/README.rst @@ -23,9 +23,24 @@ USAGE except ImportError: from PIL import Image import pytesseract + + pytesseract.pytesseract.tesseract_cmd = '' + # Include the above line, if you don't have tesseract executable in your PATH + # Example tesseract_cmd: 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract' + print(pytesseract.image_to_string(Image.open('test.png'))) print(pytesseract.image_to_string(Image.open('test-european.jpg'), lang='fra')) +Add the following config, if you have tessdata error like: "Error opening data file..." + +.. code-block:: python + + tessdata_dir_config = '--tessdata-dir ""' + # Example config: '--tessdata-dir "C:\\Program Files (x86)\\Tesseract-OCR\\tessdata"' + # It's important to add double quotes around the dir path. + + pytesseract.image_to_string(image, lang='chi_sim', config=tessdata_dir_config) + INSTALLATION ------------