Contents[ Hide ]
In this article, you will learn how to build a bare minimum console application for extracting text from an image with with Aspose.OCR for .NET.
We assume that you already have a basic knowledge of Microsoft Visual Studio and C#.
You will need
- A compatible system with Microsoft Visual Studio installed. As an individual developer, you can use a free Visual Studio Community Edition.
- Some image containing a text. You can simply download the one from the article.
- 5 minutes of spare time.
- Create a new C# project in Visual Studio. You can use a very basic project template, such as Console App.
- Install Aspose.OCR (CPU-based) NuGet package to the project.
- Save this image to bin\Debug or bin\Debug\net6.0 directory of the project under the name
- Create an instance of Aspose.OCR recognition engine:
Aspose.OCR.AsposeOcr recognitionEngine = new Aspose.OCR.AsposeOcr();
- Extract text from the image:
string result = recognitionEngine.RecognizeImage("source.png");
- Output the recognized text:
Aspose.OCR.AsposeOcr recognitionEngine = new Aspose.OCR.AsposeOcr(); string result = recognitionEngine.RecognizeImage("source.png"); Console.WriteLine(result);
Run the program. You will see extracted text in the console output:
Hello, World! I can read this text.
If you use your own image, consider the trial restrictions.
Congratulations! You have extracted the text from the image. Read the Developer reference and API reference for details on developing advanced applications with Aspose.OCR for .NET.