Take a snapshot and recognize text
- Install
tesseract
on your system:sudo port install tesseract
orbrew install tesseract
and thenbrew install tesseract-lang
if you need additional langugages. - Download the workflow
- Double click to install it in Alfred
Use the keywork OCR
, take a screenshot, wait for the notification, paste the text. For better results, you can also add a language as optionnal argument like this: OCR fra
(full list of language codes here).
Just a tiny bash script:
export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"
screencapture -i /tmp/ocr_snapshot.png
if [{query} = ""]; then
tesseract --dpi 300 /tmp/ocr_snapshot.png stdout 2>&1
else
tesseract --dpi 300 /tmp/ocr_snapshot.png stdout -l {query} 2>&1
fi
On Alfred forum: https://www.alfredforum.com/topic/12006-ocr-extract-text-from-snapshot/
Inspired by the work of https://github.com/oott123/alfred-clipboard-ocr. Thanks bergmul for his help.