Last active
February 28, 2021 11:19
-
-
Save lifeparticle/85eec6aee6f094093f44f4fe1653ca1c to your computer and use it in GitHub Desktop.
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
from PIL import Image | |
import pytesseract | |
def process_image(iamge_name, lang_code): | |
return pytesseract.image_to_string(Image.open(iamge_name), lang=lang_code) | |
def print_data(data): | |
print(data) | |
def output_file(filename, data): | |
file = open(filename, "w+") | |
file.write(data) | |
file.close() | |
def main(): | |
data_eng = process_image("test_eng.png", "eng") | |
data_ben = process_image("test_ben.png", "ben") | |
print_data(data_eng) | |
print_data(data_ben) | |
output_file("eng.txt", data_eng) | |
output_file("ben.txt", data_ben) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment