Utilities - The best way to peform OCR on images of Power Apps Formulas

I occasionally need to convert images of Power Apps formulas to text - a use-case scenario is when I'm reviewing forum questions.

In these situations, converting images to text with OCR (optical character recognition) saves a lot of time.

What's the best tool to convert images of formulas to text? This post reviews 3 options.

1 - Using the 'Text Extractor' utility in Microsoft Power Toys

Power Toys is a free set of Windows utilities with many great features. This includes Windows Explorer extensions, a Windows shell extension for resizing images, the ability to modify keyboard mappings, a bulk file renaming feature, and many more.

Here's the download link for Power Toys.


A very feature of Power Toys is 'Text Extractor'. This integrates into Windows and we start it by pressing the following keyboard combination: ⊞ Win+Shift+T

This initiates the process to take a screenshot of an image. The utility then extracts text from the screenshot and saves the result into the Windows clipboard.

To test the effectiveness of Text Extractor, I used Text Extractor to screenshot the following formula that I found on a forum post.

Here's the result from Text Extractor.

Patchl • Product Order List • ,
ForA11 Filter Gal Ler 4. All Items ! rem
WindowSizeNumber: Textln utl. Text
WindowSizeWidth: Dro downl.Se1ected.Va1ue
WindowSizeHei ht: Dro downl 1. Selected . Value
Windo uantit
. Dro downl 2. Selected. Value
WindowCoverin T
. Dro downl 3. Selected . Value
WindowFre uenc OfUse: Dro downl 4. Selected. Value
WindowShape: Dropdownl 5. Selected. Value.
Title: Self . LastSubmit. ID

As we can see, the result isn't great. Text Extractor fails to recognise much of the formula, including characters such as single quotes and brackets. It fails to recognise many of the keywords, and it confuses the 'l' in 'ForAll' with the number '1'.

2 - Using 'Copy text from Picture' in Microsoft OneNote

Microsoft OneNote includes built-in OCR capabilities. When we paste an image into a OneNote page, we can right-click the image and select the 'Copy Text from Picture' option.


This extracts the text from the image and copies the result into the clipboard. We can then paste the result where it's needed.

In the screenshot below, I pasted the result next to the source image.


The result is very similar to Text Extractor - it's not great. It doesn't correctly recognise many of the keywords and punctuation, and it also confuses the character 'l' with '1'.

3 - Using the AI Builder 'Text Recognizer' control in Power Apps

With Power Apps, we can perform OCR by using AI Builder. I created an app and added a 'text recognizer' control to a screen.

I then ran the app and uploaded a saved image of the formula through the control. In the label control shown below, I 'concat' the extracted lines into the text property.

As we can see, AI Builder produces the best result. It didn't recognise some of the punctuation but it did a great job of correctly recognsing all the keywords. Unlike the previous products, it was able to correctly differentiate the character 'l' with '1'.

Conclusion

If you need to perform ad-hoc OCR on images of formula, AI Builder produces the best result. This is understandable, given that AI builder can better interpret the context of the source image and optimise the text extraction for formula/code.

For a completely free solution, the Text Extractor utility in Power Toys offers a convenient and passable solution. In all cases, the results were not bad, considering that the formula in the source image was obscured by the red squiggly error highlighting.

Related posts

FormuIas - Is it possible to call a user-defined function recursively in Power Apps?
January 31, 2024
Formulas - A beginners guide on how to create and call user-defined functions (UDFs)
January 28, 2024
Formula - How to add a button that converts degrees Centigrade to Fahrenheit and vice versa
May 08, 2023
Formula - How to convert a single delimited string to rows and columns
April 05, 2023
Data - How to group data in a gallery and calculate sums
January 20, 2023
Formula - How to calculate compound interest
November 24, 2022
Example - How to use a drop down control to convert currencies
September 27, 2022
Formula - How to parse JSON in Power Apps- 4 examples
September 15, 2022
Data - How to get a row by ordinal number
April 28, 2022
Formula - What to do when the If statement doesn't work?
December 17, 2021
Formula - Boolean And / Or operators - What is the order of precedence?
December 16, 2021
Controls - How to set the data source of a Combo Box to a comma separated string
November 16, 2021
Numbers - 10 examples of how to round numbers
August 18, 2021
Formula - Difference between round, square, and curly brackets
July 20, 2021
Top 3 highlights of upcoming enhancements to the Power Apps language (Power FX)
May 26, 2021
Email - Sending email attachments with the Office 365 Outlook connector
March 30, 2021
Formula - What to try when numbers don't format correctly
March 24, 2021
Controls - How to convert HTML to Text
March 23, 2021
Formulas - how to return all days between two dates
March 15, 2021
Formula - How to create comma separated (CSV) list of items
February 25, 2021
Formula - How to use the IF and Switch functions - 3 common examples
February 12, 2021
Location - Finding the closest location and and sorting records by distance, based on the current location of the user
January 24, 2021
Formulas - How to cope with weekends and public holidays in date calculations
January 21, 2021