Test in a live environment
Test in production without watermarks.
Works wherever you need it to.
Many people out there may be wondering "What is an OCR Screenshot?" Others might wonder how to convert a screenshot of any text into a digital text-editable format or to .txt, or .doc format. If you are one of these people, then worry no more because we have the perfect solutions for you.
In this article, we will discuss different tools that will allow you to perform OCR, Optical Character Recognition, on screenshots.
There are many OCR tools out there but today we will be using IronOCR to extract text from screenshots.
IronOCR is a software library for the C# and VB.NET programming languages, designed to enable developers to add OCR (Optical Character Recognition) capabilities to their applications. The library can be used to recognize text in images and convert it into machine-readable text. The library is built on the Tesseract OCR engine, which is considered one of the most accurate OCR engines available.
IronOCR can be used to read text from images in many different file formats, including PNG, JPG, TIFF, and PDF. It also provides a range of advanced features for working with text recognition, such as the ability to recognize multiple languages, as well as the ability to recognize text from images that have been rotated or skewed. Additionally, developers can use IronOCR to quickly integrate OCR functionality into their applications, as it provides a simple, easy-to-use API that can be called from C# or VB.NET code. Using IronOCR you can choose your OCR language, and perform OCR on images, digital PDF files, and scanned PDF files.
IronOCR is considered a good option for developers who want to add OCR functionality to their applications. It's open source, easy to use and integrate, fast, accurate, and up-to-date with the latest OCR technologies.
IronOCR provides a wide range of features to help developers integrate OCR functionality into their applications. Some of the key features of IronOCR include:
Overall, IronOCR is a powerful tool that provides a wide range of features to help developers add OCR functionality to their applications.
Open Visual Studio and go to the File menu. Select "New Project" and then select Console Application.
Enter the project name and select the path in the appropriate text box. Then, click the Create button. Select the required .NET Framework, as in the screenshot below:
Creating a New Project in Visual Studio
The Visual Studio project will now generate the structure for the console application. Once finished, it will open the program.cs
file, in which you can write and execute source code.
The program.cs file, generated from Visual Studio's New Project Wizard
Now we can add the IronOCR library and test the program.
In Visual Studio, you can easily integrate IronOCR with your C# project.
IronOCR offers multiple processes to integrate with a C# .NET project. Here, we'll discuss one of them: installing IronOCR using the NuGet Package Manager.
In Visual Studio go to Tools > NuGet Package Manager > Package Manager Console
The NuGet Package Manager UI
After clicking, a new console will appear at the bottom of Visual Studio's window. Type the below command in the console and press enter.
Install-Package IronOcr
IronOCR will be installed in just a few seconds.
IronOCR is a powerful OCR library that can be used to recognize text from screenshots. With IronOCR, you can take a screenshot of text, and then use the library's OCR capabilities to convert the text in the screenshot into a digital, editable format. Here's an example of how you might use IronOCR to perform OCR on a screenshot in C#. To perform screenshot OCR, just capture a screenshot and run the below code to extract the text to any output format you want.
using IronOcr;
using System;
string imageText = new IronTesseract().Read("ocr.png").Text;
Console.WriteLine(imageText);
using IronOcr;
using System;
string imageText = new IronTesseract().Read("ocr.png").Text;
Console.WriteLine(imageText);
Imports IronOcr
Imports System
Private imageText As String = (New IronTesseract()).Read("ocr.png").Text
Console.WriteLine(imageText)
Sample Screenshot used for input
- IRONOCR for NET
- The C# OCR Library
- OCR for C# to scan and read images & PDFs
- NET OCR library with 127+ global language packs
- Output as text, structured data, or searchable PDFs
- Supports NET 6, 5, Core, Standard, Framework
IronOCR allows you to perform OCR on specific zones within an image. This can be useful when the image contains multiple regions of text, and you only want to recognize the text within a specific region. An example code for this is shown below.
using IronOcr;
using IronSoftware.Drawing;
using System;
var ocrTesseract = new IronTesseract();
using (var ocrInput = new OcrInput())
{
var contentArea = new CropRectangle(x: 0, y: 0, width: 350, height: 150);
ocrInput.AddImage("ocr.png", contentArea);
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
}
using IronOcr;
using IronSoftware.Drawing;
using System;
var ocrTesseract = new IronTesseract();
using (var ocrInput = new OcrInput())
{
var contentArea = new CropRectangle(x: 0, y: 0, width: 350, height: 150);
ocrInput.AddImage("ocr.png", contentArea);
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
}
Imports IronOcr
Imports IronSoftware.Drawing
Imports System
Private ocrTesseract = New IronTesseract()
Using ocrInput As New OcrInput()
Dim contentArea = New CropRectangle(x:= 0, y:= 0, width:= 350, height:= 150)
ocrInput.AddImage("ocr.png", contentArea)
Dim ocrResult = ocrTesseract.Read(ocrInput)
Console.WriteLine(ocrResult.Text)
End Using
To perform OCR on an image and save the recognized text in .txt file, you can use the following code.
using IronOcr;
using System;
var ocr = new IronTesseract();
using (var input = new OcrInput("ocr.png"))
{
var result = ocr.Read(input);
result.SaveAsTextFile("output.txt");
}
using IronOcr;
using System;
var ocr = new IronTesseract();
using (var input = new OcrInput("ocr.png"))
{
var result = ocr.Read(input);
result.SaveAsTextFile("output.txt");
}
Imports IronOcr
Imports System
Private ocr = New IronTesseract()
Using input = New OcrInput("ocr.png")
Dim result = ocr.Read(input)
result.SaveAsTextFile("output.txt")
End Using
The contents of the output file are shown below:
Contents of the generated output.txt file
Read the Image Text Extraction tutorial for more information about how to perform OCR on images.
IronOCR is part of a suite of five .NET libraries designed to work with different types of documents. You can purchase all five libraries for the price of just two licenses.
9 .NET API products for your office documents