How to Convert a Scanned Image into Text using Go

While our phones & cameras can now perform many of the essential functions previously performed exclusively by scanning machines, they still can’t guarantee a perfect quality output for Optical Character Recognition (OCR) services. If you have a scanner available to you, scanning documents is still the way to go — and our Scanned Image to Text API can convert these scanned documents to text with extremely high fidelity.

This API is intended exclusively for use with scanned images of documents (we offer a different API solution for documents photographed by any type of smartphone or camera), and it provides the option to increase the fault tolerance of your scan by setting a ‘recognitionMode’ field to values including Basic (not resilient to rotation, skew or low-quality images), Normal (highly fault tolerant) and Advanced (highest quality & most fault-tolerant).

In addition, this API supports dozens of common languages — including English, Arabic, Chinese & more, which can be enabled by entering your desired language’s three-letter abbreviation into the appropriate field — and offers an optional preprocessing feature (automatically enabled; disable with the string value ‘None’) which enhances the quality of the scanned image prior to performing the scan.

Using the complementary Golang code examples provided below, you can easily take advantage of this API & include its service within your OCR applications. You can use it completely free by registering a free account on our website (this will yield a free-tier API key valid for 800 API calls per month).

Simply copy the below code into your file, include your API key string & file inputs in their respective fields, and you’re good to go:

Please note that higher fault tolerance settings will increase the number of API calls used per document. Basic mode will use 1–2 API calls, Normal mode will use 26–30 API calls, and Advanced (the default setting) will use 28–30 API calls per document.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.