Skip to content

Instantly share code, notes, and snippets.

@sebastianrothbucher
Last active January 19, 2025 16:28
Show Gist options
  • Save sebastianrothbucher/9be7d59fe64693e063069f705571c145 to your computer and use it in GitHub Desktop.
Save sebastianrothbucher/9be7d59fe64693e063069f705571c145 to your computer and use it in GitHub Desktop.
img2txt - clipboard image to clipboard text (per se: on Mac)
#!/bin/zsh
/opt/homebrew/bin/python3 -c 'import pytesseract; from PIL import Image, ImageGrab; im = ImageGrab.grabclipboard(); pytesseract.pytesseract.tesseract_cmd = "/opt/homebrew/bin/tesseract"; print(pytesseract.image_to_string(im))' | pbcopy # python3.12 for specific python
# done
#!/bin/bash
brew install python3 # only if you didn't already
brew install tesseract
pip3 install pillow pytesseract --break-system-packages # or create a venv; pip3.12 for specific python
# (done)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment