pytesseract

# 'tesseract' CLI command required
brew install tesseract --all-languages
pip install pytesseract
from PIL import Image
import pytesseract

# Simple image to string
print(pytesseract.image_to_string(Image.open('test.png')))

# French text image to string
print(pytesseract.image_to_string(Image.open('test-european.jpg'), lang='fra'))

# Get bounding box estimates
print(pytesseract.image_to_boxes(Image.open('test.png')))

# Get verbose data including boxes, confidences, line and page numbers
print(pytesseract.image_to_data(Image.open('test.png')))
image_to_data(image, lang=None, config='', nice=0, output_type=Output.STRING)
image Object
PIL Image/NumPy array of the image to be processed by Tesseract
lang String
Tesseract language code string
config String
Any additional configurations as a string, ex: config='–psm 6'
nice Integer
modifies the processor priority for the Tesseract run. Not supported on Windows. Nice adjusts the niceness of unix-like processes.
outputtype Class attribute
specifies the type of the output, defaults to string. For the full list of all supported types, please check the definition of pytesseract.Output class.