Skip to content

Commit 4a4c515

Browse files
authored
Tesseract OCR 샘플
1 parent 4d14f40 commit 4a4c515

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tesseract_ocr_sample.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# pip install pytesseract
2+
3+
from PIL import Image
4+
import pytesseract
5+
6+
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
7+
text = pytesseract.image_to_string(Image.open("news.png"), lang="kor")
8+
print(text)
9+
10+
with open("news.txt", "w", encoding="utf8") as f:
11+
f.write(text)
12+

0 commit comments

Comments
 (0)