Automation Tasks Series: Using OCR on an Image in Alfred
This is a three-part series on Alfred's Automation Tasks workflow object.
In the first part, we created a workflow to quit all apps except some pre-defined ones, allowing you to quickly create a focused work environment.
With 231 Automation Tasks at your fingertips and more being added regularly, you can create powerful workflows with no need to know how to script or code anything!
In this second part, we'll create a workflow using the "OCR Image" Automation Task.
What's OCR? Optical Character Recognition is the process that converts the text found in an image into a machine-readable text format. In other words, the Automation Task will identify text in an image and copy it to Alfred's Clipboard, so that you can use it somewhere else.
Setting up the OCR workflow basics
The File Filter Input and Automation Task object are the first two objects to connect; We'll add two more useful objects to the workflow later.
The File Filter is configured with:
- The keyword
ocr - A placeholder title and subtext of your choice
- File types PNG and JPEG: Drag in files of relevant types from Finder or Alfred's results
All other File Filter settings have been left to defaults, though you can limit the scope (which folders you want to search) or set a date range if you'd like to narrow down your results.

The File Filter is connected to an Automation Task object, where we'll select the OCR Image task from Core Automation Tasks > Image Manipulation section.

Our workflow is now functional; We can find an image file and process it with the OCR Image Automation Task... but we need to do something with the text found in the image, known as the query, so we connect a Copy to Clipboard Output to use it.
This query can be pasted to the frontmost app by checking the relevant box in the preferences, or prefixed/appended with additional text.

Finally, we'll add a Post Notification Output to let us know once the OCR task has completed, and show us the captured text.

Our workflow should now look like this:

Testing the OCR workflow for text recognition
Now that the workflow objects have been configured, let's test the workflow.
As a sample file, we'll use an image from the beautiful children's book "Zoom" by Sha'an D'Anthes.

Using the ocr File Filter keyword followed by the file name, we can select the image file.

Immediately, the Automation Task processes the image content, copies the found text to the Clipboard and pops up a post notification with the text:
"Scout smiled at little red Mars, and little red Mars smiled right back."

Other ways to use the OCR Output
There are so many ways you could use the output from the OCR workflow; Trigger an email, add it to an existing text file, pass it to another workflow object to search the web or internal documentation.
We have one more guide to creating workflows with Automation Tasks for you next week!

