Skip to content

Commit

Permalink
create ocr-test-1.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Christine-DK committed Apr 19, 2023
1 parent 8238b2c commit 2d8601d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ocr-test-1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Import the required modules
import pytesseract
from PIL import Image

# Set the path for the Tesseract executable
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'

# Open the image using Pillow library
img = Image.open('image.png')

# Convert the image to grayscale
img = img.convert('L')

# Perform OCR using Tesseract
text = pytesseract.image_to_string(img)

# Print the extracted text
print(text)

0 comments on commit 2d8601d

Please sign in to comment.