ChicK00o / alfred-ocr

Take a snapshot and recognize text

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Alfred Workflow OCR

Take a snapshot and recognize text

alfred-ocr.png

Installation

  1. Install tesseract on your system: sudo port install tesseract or brew install tesseract and then brew install tesseract-lang if you need additional langugages.
  2. Download the workflow
  3. Double click to install it in Alfred

Usage

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).

Capture-d-e-cran-2018-11-09-a-10-06-07.png

What's inside?

Just a tiny bash script:

export PATH=/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

Discussion

On Alfred forum: https://www.alfredforum.com/topic/12006-ocr-extract-text-from-snapshot/

Credits

Inspired by the work of https://github.com/oott123/alfred-clipboard-ocr. Thanks bergmul for his help.

About

Take a snapshot and recognize text

License:MIT License