Click here to Skip to main content
11,934,809 members (41,739 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# .NET
How to Convert .tif file to .txt file in Windows application(.Net(C#))
Posted 4-Apr-13 20:59pm
Sandeep Mewara 5-Apr-13 2:06am
Tried anything so far?
Prasad Khandekar 5-Apr-13 2:46am
Hello Dheerendra,

Why not use any OCR software?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Path.ChangeExtension can be used to change the extention of Path string

String filePath = "E:\\WindowsPractice\\Class1.tif";
Path.ChangeExtension(filePath, ".txt");

To change the extention of the file physically:

File.Move(filePath, Path.ChangeExtension(filePath, ".txt"));
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Hello Dheerendra,

Here is a small snippet based on ASPOSE OCR SDK.
//Create OcrEngine instance and assign image, language and image configuration
OcrEngine ocr = new OcrEngine();
ocr.Image = ImageStream.FromFile("YOUR IMAGE PATH");
ocr.Config.NeedRotationCorrection = chkRotation.Checked;
ocr.Config.UseDefaultDictionaries = true;
//Set resource file name and extract OCR text
using (ocr.Resource = new FileStream(resourceFileName, FileMode.Open)) {
    if (ocr.Process()) {
        strText = ocr.Text.ToString();

A more complete sample can be found on ASPOSE web site[^]. There is a freeware wrapper[^] available for Tesseract[^] OCR Library as well. Another alternative is to use MODI which is part of Microsoft Office.

Dheerendra Dwivedi 8-Apr-13 8:08am
But how to Add OcrEngin in my Application
Prasad Khandekar 8-Apr-13 8:42am
First you need to purchase ASPOSE OCR SDK or dowload the trial version. The link is given in the solution. Next you have to add reference to the Aspose OCR assembly.

1. Right-click the project's References node and select Add Reference from the menu.
2. In the Add Reference dialog, select the .NET tab
3. If you used an MSI installer to install Aspose.OCR, Aspose.OCR is listed in the top pane. Select Aspose.OCR and then click Select
4. If you downloaded and unpacked the DLL only, locate the Aspose.OCR.dll file using the Browse button

The getting started guide for Aspose.OCR Sdk is available here (

Dheerendra Dwivedi 11-Apr-13 7:13am
mdoc.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, True, True)is giive me OCR Error
Prasad Khandekar 11-Apr-13 8:00am
What's the error?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151126.1 | Last Updated 5 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100