How it works

The image is first loaded as a Pillow Image object.  We can directly pass this object to the pytesseract image_to_string() function.  That function runs tesseract on the image and returns the text that it found.

Get Python Web Scraping Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.