Getting Text from Images with Python

less than 1 minute read

Adventures with OCR!

  1. Download the goods
brew install tesseract
  1. Create and activate virtual environment
python3 -m venv ocr-env
source ocr-virt/bin/activate
source ocr-env/bin/activate
  1. Pip install pytesseract (which should also download PIL – Python Image Library)
pip install pytesseract

RUN TEST:

try:
    from PIL import Image
except ImportError:
    import Image
import pytesseract

print(pytesseract.image_to_string(Image.open('crime.jpg')))

Updated: