Created
June 11, 2024 13:05
-
-
Save sebastianrothbucher/9be7d59fe64693e063069f705571c145 to your computer and use it in GitHub Desktop.
img2txt - clipboard image to clipboard text
This file contains 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
#!/bin/zsh | |
/opt/homebrew/bin/python3 /Users/s.rothbucher/tools/ocr/main.py | pbcopy |
This file contains 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
import pytesseract | |
from PIL import Image, ImageGrab | |
im = ImageGrab.grabclipboard() | |
#im.save('somefile.png','PNG') | |
# If you don't have tesseract executable in your PATH, include the following: | |
pytesseract.pytesseract.tesseract_cmd = r'/opt/homebrew/bin/tesseract' | |
# Simple image to string | |
print(pytesseract.image_to_string(im)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment