Home > Uncategorized > Free OCR using C= #Webservice

Free OCR using C= #Webservice

Converting an image into text is a difficult job for a computer, hence the pervasive use of Captcha images, however, OCR (optical character recognition) is quite effective with printed text.

Here’s a free webservice provided by a9t9, it’s limited to 500 requests/day or 15000 requests/month per IP address. You can get more quota by emailing a9t9 – You provide it with a url with an image that contains text;

It returns it’s results in JSON, so the bulk of this code is really just to convert the response to a simple string.

public string Automatic(string imageUrl)
var wc = new WebClient();
wc.Headers[“Content-Type”] = “application/x-www-form-urlencoded”;
const string strUrl = “https://ocr.a9t9.com/api/Parse/Image”;
var strPostData = “apikey=helloworld”;
strPostData += “&url=” + HttpUtility.UrlEncode(imageUrl);
var strJson = wc.UploadString(strUrl, “POST”, strPostData);
var result = JavascriptDeserialize<A9T9>(strJson);
return result.ParsedResults.First().ParsedText;

And the json conversion;

/// <summary>
/// Converts a JSON string into an object of type T.
/// </summary>
/// <typeparam name=”T”></typeparam>
/// <param name=”json”>The JSON string.</param>
/// <returns></returns>
public static T JavascriptDeserialize<T>(string json)
var jsSerializer = new JavaScriptSerializer { MaxJsonLength = Int32.MaxValue };
return jsSerializer.Deserialize<T>(json);

public class ParsedResult
public int FileParseExitCode { get; set; }
public string ParsedText { get; set; }
public string ErrorDetails { get; set; }

public class A9T9
public List<ParsedResult> ParsedResults { get; set; }
public int OCRExitCode { get; set; }
public bool IsErroredOnProcessing { get; set; }
public object ErrorDetails { get; set; }

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: