Home > Uncategorized > Convert an Image to text in C#

Convert an Image to text in C#

If you want to extract text from an image, then you can use a process called OCR.  If you create a new project in Visual Studio, then make a web service reference to http://free-ocr.co.uk/ocr.asmx called “ocr”

A limitation of this free service, is that the image must be at most 100 x 100 pixels

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using simpleOCR.ocr;

namespace simpleOCR
class Program
static void Main(string[] args)

var sFile = new FileStream(@”C:\hello.jpg”,FileMode.Open);
byte[] PhotoBytes = new byte[sFile.Length];
sFile.Read(PhotoBytes, 0, PhotoBytes.Length);
simpleOCR.ocr.ocr webservice = new simpleOCR.ocr.ocr();
Console.Out.Write(webservice.Analyze(“your email”, PhotoBytes));

Categories: Uncategorized
  1. August 4, 2017 at 3:10 am

    I recommend xsocr tool http://www.xspdf.com/guide-ocr/text-recognition-from-image/, it can recognize text from image with higher accuracy


  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 )

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: