How to Convert a Photo of a Document into Text using Go

When we convert images of documents into plain, unformatted digital text, we need to first determine the sources of the image itself. Was this document scanned, or was it photographed instead (using a smartphone or any other handheld camera)? If the latter, our chosen OCR service will need to offer better built-in fault tolerance features to accommodate background objects (such as the desk the document was photographed on) and crooked camera angles. Built specifically for use on hand-photographed documents, our Photo Document to Text OCR API provides exactly those fault tolerant advantages, along with two (optionally) customizable features including:

  1. RecognitionMode: this can be set to Basic (low fault tolerance) or Normal (high fault tolerance) values; the default is Advanced (highest fault tolerance).
  2. Language selection: this API supports dozens of common languages, including English, Spanish, Bengali, Dutch, and more.

To use this API, you’ll first need to get a Cloudmersive API key by registering a free account on our website (free accounts yield a limit of 800 API calls per month), and after that, you can simply copy & paste the below Golang code examples into your file to structure your API call. That’s all there is to it — just include your API Key & document image (common formats such as JPG & PNG are supported) in their respective fields, and you’re ready to convert to text.

--

--

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
Cloudmersive

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