Skip to content

Instantly share code, notes, and snippets.

@codeperfectplus
Created April 19, 2021 06:25
Show Gist options
  • Save codeperfectplus/46a5b150bb6fb587aa8d0ffb04fb70ea to your computer and use it in GitHub Desktop.
Save codeperfectplus/46a5b150bb6fb587aa8d0ffb04fb70ea to your computer and use it in GitHub Desktop.
Optical Character Recognition Using PyTesseract
from PIL import Image
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r"path_to_tessract.exe"
def ocr(filename):
img = Image.open(filename)
text = pytesseract.image_to_string(img)
return text
print(ocr_core('sample2.png'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment