-
-
Save etrigger/ee662fb9c684967c20562629f2b94db6 to your computer and use it in GitHub Desktop.
Grayscale/Binary images using PIL
This file contains hidden or 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
im=Image.open("1.jpg") | |
#im=im.rotate(1) | |
im.save("e.jpg") | |
im2=im.convert("L") | |
im2.save("b.jpg") | |
threshold = 100 | |
im = im2.point(lambda p: p > threshold and 255) | |
im.save("d.jpg") | |
img="d.jpg" | |
result = tesseract.ProcessPagesWrapper(img,api) | |
print result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment