Created
October 13, 2016 02:05
-
-
Save boweiliu/aafe6b02aaaedbcc1d8051c6b9254879 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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