Italian OCR in C# and .NET
Other versions of this document:
IronOCR is a C# software component allowing .NET coders to read text from images and PDF documents in 126 languages, including Italian.
It is an advanced fork of Tesseract, built exclusively for .NET developers and regularly outperforms other Tesseract engines for both speed and accuracy.
Contents of IronOcr.Languages.Italian
This package contains 6 OCR language modes for .NET:
- Italian
- ItalianBest
- ItalianFast
- ItalianOld
- ItalianOldBest
- ItalianOldFast
Download
Italian Language Pack [italiano]
Installation
The first thing we have to do is install the Italian OCR package to your .NET project.
Install-Package IronOCR.Languages.Italian
Code Example
This C# code example reads Italian text from an image or PDF document.
// Include IronOcr library
using IronOcr;
class Program
{
static void Main()
{
// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();
// Set the OCR language to Italian
Ocr.Language = OcrLanguage.Italian;
// Read text from an image file
using (var Input = new OcrInput(@"images\Italian.png"))
{
// Perform OCR to get the text content from the image
var Result = Ocr.Read(Input);
// Get and print all the recognized text
var AllText = Result.Text;
Console.WriteLine(AllText);
}
}
}
// Include IronOcr library
using IronOcr;
class Program
{
static void Main()
{
// Create a new instance of the IronTesseract class
var Ocr = new IronTesseract();
// Set the OCR language to Italian
Ocr.Language = OcrLanguage.Italian;
// Read text from an image file
using (var Input = new OcrInput(@"images\Italian.png"))
{
// Perform OCR to get the text content from the image
var Result = Ocr.Read(Input);
// Get and print all the recognized text
var AllText = Result.Text;
Console.WriteLine(AllText);
}
}
}
' Include IronOcr library
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Create a new instance of the IronTesseract class
Dim Ocr = New IronTesseract()
' Set the OCR language to Italian
Ocr.Language = OcrLanguage.Italian
' Read text from an image file
Using Input = New OcrInput("images\Italian.png")
' Perform OCR to get the text content from the image
Dim Result = Ocr.Read(Input)
' Get and print all the recognized text
Dim AllText = Result.Text
Console.WriteLine(AllText)
End Using
End Sub
End Class
Explanation:
- Using IronOCR: The
IronOcr
library is included to utilize its OCR capabilities. - Creating an IronTesseract Instance:
IronTesseract
is a core class used for OCR processing. - Setting Language: OCR is set to process the Italian language using
Ocr.Language = OcrLanguage.Italian
. - Reading Input: An
OcrInput
object is created to specify the image file. - Performing OCR:
Ocr.Read(Input)
executes the OCR process on the input image and returns the text result. - Output: The resulting text is stored in
AllText
and displayed in the console.
Make sure the images\Italian.png
file path is correct, and the file exists for the example to work properly.