We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 3dafc6a + 5688a41 commit 8b2b725Copy full SHA for 8b2b725
image3.png
20.3 KB
text_image.py
@@ -0,0 +1,18 @@
1
+from PIL import Image
2
+from pytesseract import pytesseract
3
+# Defining paths to tesseract.exe
4
+# and the image we would be using
5
+path_to_tesseract = r"C:\Program Files\Tesseract-OCR\tesseract.exe"
6
+image_path = r"C:\Users\kusha\Downloads\image3.png"
7
+# Opening the image & storing it in an image object
8
+img = Image.open(image_path)
9
+# Providing the tesseract
10
+# executable location to pytesseract library
11
+pytesseract.tesseract_cmd = path_to_tesseract
12
+# Passing the image object to
13
+# image_to_string() function
14
+# This function will
15
+# extract the text from the image
16
+text = pytesseract.image_to_string(img)
17
+# Displaying the extracted text
18
+print(text[:-1])
0 commit comments