Skip to content

Instantly share code, notes, and snippets.

@boweiliu
Created October 13, 2016 02:05
Show Gist options
  • Save boweiliu/aafe6b02aaaedbcc1d8051c6b9254879 to your computer and use it in GitHub Desktop.
Save boweiliu/aafe6b02aaaedbcc1d8051c6b9254879 to your computer and use it in GitHub Desktop.
from PIL import Image
from cStringIO import StringIO
import requests
import pyocr
tools = pyocr.get_available_tools()
tool = tools[0]
print(tool.get_available_languages())
url = 'http://i.imgur.com/1WpmXbo.jpg'
imgstr = requests.get(url).content
print(repr(imgstr[:4]))
txt = tool.image_to_string(Image.open(StringIO(imgstr)), lang='eng')
print txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment