September 18, 2014 8:00 am

Microsoft OCR Library for Windows Runtime

This blog was written by Jelena Mojasevic, Program Manager at Microsoft.

We are pleased to announce that Microsoft OCR Library for Windows Runtime has been released as a NuGet package. The library empowers you to easily add text recognition capabilities in your Windows Phone 8/8.1 and Windows 8.1 Store apps.

OCR technology enables various scenarios – copying text from images, text search in images, translation… It was designed with flexibility and performance in mind, as it allows for OCR of high variety of image types and has numerous performance optimizations. The library runs entirely on client, supports 21 languages and enables processing images from various sources – camera, local file or network.

To get started, open your app project in Visual Studio and select PROJECT | Manage NuGet Packages, then search for Microsoft OCR. The documentation is available at MSDN in the same format as for Platform API. The library is free and there will be no fees for runtime licenses of commercial applications developed with the library.

The OCR Library extracts text and layout information from the image. When you add the OCR Library to an application, you control how your application interprets the returned text, for example you can recognize patterns such as email addresses, phone numbers, and URLs, and your app can launch common actions such as sending an email, making a phone call, or visiting a web site.

It’s really simple to run OCR on an image, demonstrated in code snippets below:


OcrResult result = await ocrEngine.RecognizeAsync(height, width, pixels);

The RecognizeAsync method’s arguments are the image dimensions and byte array of image pixels in BGRA format. The extracted text and layout info are contained within OcrResult:C# 2

if (result.Lines != null)


string recognizedText = "";

foreach (var line in result.Lines)


foreach (var word in line.Words)


recognizedText += word.Text + " ";


recognizedText += Environment.NewLine;


OcrText.Text = recognizedText;


For more info about the OCR Library, visit MSDN page and download OCR library sample app. See the NuGet documentation for all the ways you can download and install the NuGet package in your project.

If you’d like to share your feedback with the Microsoft OCR team, please send a mail.

Updated June 28, 2018 7:44 am

Join the conversation

  1. Hi Vidar, from what I understand this is a client-side library, not a server-side one, though it would be nice if they made it available for use in servers too (could connect with Windows Azure Marketplace [WAM] to track usage for example and above some usage you’d buy more “credit”)

    • You misinterpret the line: “The library runs entirely on client”. They don’t mean client-side as in JavaScript client-side. (Although it can also be used when implementing metro apps using JavaScript). They mean that you don’t need to upload the results to some cloud service for analyses.
      It runs entirely in your application.

  2. How ironic in a post about an OCR library, all the code snippets are images.

    • It’s not ironic. To copy the code snippets, you’re supposed to create/run the samples and OCR the images. That way, you know that the thing works.

  3. Why is this only available to Phone/Store apps?

    I assume that the OCR library is procecing pixels in the form of bytes so this should be possible to do in any part of .Net?
    Is it because the library depends heavily on something in WinRT or is it to force us to only use WinRT?
    Or is the library already available in .Net under another name?

  4. Nice Tutorial!!!!

    I followed the tutorial from this following link( and i am able to use the scanning API successfully for WP8. But, I need to scan the OCR values with numerical and special characters(#, >)
    With Microsoft OCR Library, i am able to scan the alpha-numerical and NOT able to scan the special characters(>) and sometimes # will be read as // or “”.
    Can anyone help me out.

  5. I worked on OCR library 2 months back. I was amazed with its performance, and made two apps based on this which are on windows store. But now it seems not working anymore.Then I tried to run the Microsoft OCR Library Sample app, it is also not working now.It works in debug mode only.I ran Windows certifications test and it showed the error that It is using API which is not part of windows SDK for windows apps. Please do something regarding this as soon as possible.

  6. What type of client application is required to use with this OCR library? Would WinForm works with this lib? I see a reference to code behind I hope that is not ASP code behind. Does only work on mobile windows platform?