OCR Preprocessing API — Convert an Image of Text into Binarized (Light & Dark View)

It’s a lot easier to perform an OCR operation when the document in question has a simpler color scheme. After all, we usually don’t need OCR conversions to contain color. With the help of our Binarization OCR Preprocessing API, you can ensure all documents are converted to light & dark view before the subsequent OCR conversion.

To take advantage of this API, all you need to do is follow instructions below to structure your API call with JavaScript. If you’re looking to use a different programming language, check out our Cloudmersive API Console to find code available in a dozen common programming languages.

To get started, let’s install the jQuery library. Just run the below command:

`bower install jquery

Now let’s include a snippet to capture the input image file for this operation:

var form = new FormData();
form.append("imageFile", fileInput.files[0], "file");

After that, it’s time to call the preprocessing function. Include the below code examples, and make sure to supply your Cloudmersive API key where it says to do so:

var settings = {
"url": "https://api.cloudmersive.com/ocr/preprocessing/image/binarize",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "multipart/form-data",
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
$.ajax(settings).done(function (response) {

All done. If you don’t currently have a Cloudmersive API key, you can get one easily by registering for a free account on our website (Home — Cloudmersive APIs).




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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Drag & Drop HTML Elements and Files using Javascript

Centralizing WordPress Code with a Theme Wrapper, Custom Actions and Layout Classes


These 10 Simple JavaScript Getting Tricks To Complete Your Tasks Quickly And Efficiently

Handling dynamic web tables in Selenium : power of custom XPath

[WSO2 APIM 4 Micro Integrator Profile] Aggregate JSON responses into Array/Object

How to extract Files and Folders from a Zip Archive in Node.JS

5 Reasons to Use React (And a Few Reasons Not To)

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.

More from Medium

OCR Preprocessing API: Get the Angle of the Page, Document or Receipt for an OCR Conversion

OJET — Proxy to Backend REST API Server

How To Install Oracle Web Logic Server In Eclipse/STS