Skip to content

johnnyhoichuen/alfred-ocr

 
 

Repository files navigation

Alfred Workflow OCR

** A slightly modified version from nicooprat's project **

Usage

Read the Full tutorial here.

1. Type ocr in Alfred
2. Take a screenshot
3. Wait for the notification
4. Paste the text!!

normal-use.gif

You can use it to recognise any languages.

multi-lang.gif

Even with multiple languages (traditional Chinese + English by default).
You can also add a language as optionnal argument like this: ocr fra (full list of language codes here).

For changing the default languages, please read my Medium article.

Installation

  1. Install tesseract on your system:

    a. Install Homebrew if you haven't

    b. Then brew install tesseract (if you need English only) or brew install tesseract-lang( if you need additional langugages, this will install most of the popular languages)

  2. Download the workflow

  3. Double click to install it in Alfred

What's inside

export PATH=/usr/local/bin/:$PATH 
screencapture -i /tmp/ocr_snapshot.png

if [{query} = ""]; then 
   # now using OCR for traditional Chinese and English
   # replace (chi_tra+eng) with your default language(s)
  tesseract /tmp/ocr_snapshot.png stdout -l chi_tra+eng 2>&1 
else 
  tesseract /tmp/ocr_snapshot.png stdout -l {query} 2>&1 
fi

**(choose your language codes from here!).

Discussion

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

Credits

Based on project by nicooprat

About

Take a snapshot and recognize text

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published