125 International OCR Languages
IronOCR Language Support
IronOCR supports 125 international languages. Other than English, which is installed by default, additional language packs can be added to your .NET project via NuGet or downloaded from our Languages Page.
Most languages are available in Fast, Standard (recommended), and Best quality. The Best quality option may offer more accurate results, but will also be slower in processing time.
Sample Code for Installing Language Packs
Below is a sample code snippet demonstrating how to install and use additional language packs in your .NET project using IronOCR. Install the IronOcr.Languages.{LanguageName}
package using NuGet
. Here is how to do it in a C# application.
// First, ensure you have the following NuGet packages:
// - IronOcr
// - IronOcr.Languages.{LanguageName} // Replace {LanguageName} with your language choice, e.g., French.
using IronOcr;
class Program
{
static void Main(string[] args)
{
// Define a file path for the OCR image
var inputFilePath = "path\\to\\your\\sample-image.png";
// Choose the OCR language. The below example demonstrates using French.
var OcrLanguage = IronOcr.Languages.French.OcrLanguagePack.Best();
// Initialize IronTesseract engine with the specified language
var OcrEngine = new IronTesseract
{
Language = OcrLanguage
};
// Perform OCR to convert image text into a string
using (var Input = new OcrInput(inputFilePath))
{
// Recognize text from the image
var result = OcrEngine.Read(Input);
System.Console.WriteLine(result.Text);
}
// Output: The text content extracted from the image is displayed on the console.
}
}
// First, ensure you have the following NuGet packages:
// - IronOcr
// - IronOcr.Languages.{LanguageName} // Replace {LanguageName} with your language choice, e.g., French.
using IronOcr;
class Program
{
static void Main(string[] args)
{
// Define a file path for the OCR image
var inputFilePath = "path\\to\\your\\sample-image.png";
// Choose the OCR language. The below example demonstrates using French.
var OcrLanguage = IronOcr.Languages.French.OcrLanguagePack.Best();
// Initialize IronTesseract engine with the specified language
var OcrEngine = new IronTesseract
{
Language = OcrLanguage
};
// Perform OCR to convert image text into a string
using (var Input = new OcrInput(inputFilePath))
{
// Recognize text from the image
var result = OcrEngine.Read(Input);
System.Console.WriteLine(result.Text);
}
// Output: The text content extracted from the image is displayed on the console.
}
}
' First, ensure you have the following NuGet packages:
' - IronOcr
' - IronOcr.Languages.{LanguageName} // Replace {LanguageName} with your language choice, e.g., French.
Imports IronOcr
Friend Class Program
Shared Sub Main(ByVal args() As String)
' Define a file path for the OCR image
Dim inputFilePath = "path\to\your\sample-image.png"
' Choose the OCR language. The below example demonstrates using French.
Dim OcrLanguage = IronOcr.Languages.French.OcrLanguagePack.Best()
' Initialize IronTesseract engine with the specified language
Dim OcrEngine = New IronTesseract With {.Language = OcrLanguage}
' Perform OCR to convert image text into a string
Using Input = New OcrInput(inputFilePath)
' Recognize text from the image
Dim result = OcrEngine.Read(Input)
System.Console.WriteLine(result.Text)
End Using
' Output: The text content extracted from the image is displayed on the console.
End Sub
End Class
Explanation
- NuGet Packages: Install the necessary IronOCR NuGet packages. The primary package is
IronOcr
and you need to add the language-specific package likeIronOcr.Languages.French
for French. - Define the File Path: Set the path of the image file you want to process with OCR.
- Select the Language Pack: Use the
OcrLanguagePack
for your desired language (best, standard, or fast quality). - Initialize the OCR Engine: Create an instance of
IronTesseract
and set its language to the selected language pack. - Read the Image: Using
OcrInput
, process the image file and extract text usingRead
, which returns the OCR result as text. - Output the Result: The recognized text is printed to the console.
This setup allows you to process images and recognize text in the desired language, including non-default languages, with varying levels of quality and speed.