Skip to content

Instantly share code, notes, and snippets.

@roger-link
Created March 20, 2014 20:42
Show Gist options
  • Save roger-link/9673385 to your computer and use it in GitHub Desktop.
Save roger-link/9673385 to your computer and use it in GitHub Desktop.
import pyocr
import pyocr.builders
import glob
import Image
tools = pyocr.get_available_tools()
tool = tools[0]
langs = tool.get_available_languages()
lang = langs[0]
IMAGE_PATH = '/home/ubuntu/images/*'
files = glob.glob(IMAGE_PATH)
text = {}
for file in files:
text[file] = tool.image_to_string(Image.open(file),
lang=lang,
builder=pyocr.builders.TextBuilder())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment