Fast OCR Configuration in C# for Optimal Performance
IronOCR's fast configuration can speed up OCR processing - by about 17% in our 10-image benchmark below - with minimal accuracy impact, by using EnglishFast language mode and disabling unnecessary features like barcode reading. This optimization is ideal for high-volume processing where time is critical.
IronOCR works effectively out of the box. When speed is prioritized over absolute accuracy, IronOCR offers a fast configuration. This setting provides significant scanning performance gains with minimal accuracy impact, making it much quicker than the standard OCR configuration.
This article demonstrates how to set up fast configuration and compares benchmark results between fast and standard IronOCR configurations. Whether you're processing scanned documents, PDFs, or images, these optimizations can significantly improve your application's performance.
How to Set Up OCR Fast Configuration
- Install the OCR Library with NuGet to set up
IronOcr - Initialize the OCR engine
- Set the
LanguagetoEnglishFast - Set the
ReadBarCodesproperty tofalse - Load the image and extract text
The main component for fast configuration is the Language property. Setting the Language property to OcrLanguage.EnglishFast prioritizes speed over a small potential cost in accuracy. This allows IronOCR to read in bulk much more quickly, which is especially useful in mission-critical applications where time is essential.
Along with setting the fast language, you can gain further speed by disabling unnecessary configurations, such as ReadBarCodes. Let IronOCR auto-detect the page segmentation to keep the setup simple. For more advanced configuration options, see our Tesseract detailed configuration guide.
The code example below processes the following input image:
What Input Format Should I Use?

What Code Do I Need for Fast Configuration?
-
1Install IronOCR with NuGet Package Manager
-
2Copy and run this code snippet.
/* :path=/static-assets/ocr/content-code-examples/how-to/ocr-fast-configuration.cs */ using IronOcr; using System; var ocrTesseract = new IronTesseract(); // Fast Dictionary ocrTesseract.Language = OcrLanguage.EnglishFast; // Turn off unneeded options ocrTesseract.Configuration.ReadBarCodes = false; // Assume text is laid out neatly in an orthogonal document ocrTesseract.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.Auto; using var ocrInput = new OcrInput(); ocrInput.LoadImage("image.png"); var ocrResult = ocrTesseract.Read(ocrInput); Console.WriteLine(ocrResult.Text);C# -
3Deploy to test on your live environment
Start using IronOCR in your project today with a free trial
What Output Can I Expect?

This is the text output extracted from above. The OCR engine accurately captures the literary text while maintaining the original formatting and structure. The fast configuration provides excellent results for clear, high-contrast text like this example.
How Does Fast Configuration Compare to Standard?
To demonstrate the real-world impact, we benchmark the performance of standard against fast configuration. We use a set of 10 sample images, each containing several paragraphs, to compare performance and visualize the trade-offs of using fast configuration.
For the standard configuration, we initialize IronTesseract with its default settings, without applying any speed-oriented properties. This benchmark approach is similar to our performance tracking guide, which shows how to monitor OCR operations in real-time.
Here are the sample inputs we use to run the test. These images represent typical document scenarios you might encounter when processing multi-page documents or batch operations.
How Do I Run the Benchmark?
using IronOcr;
using System;
using System.Diagnostics;
using System.IO;
// --- Tesseract Engine Setup ---
var ocrTesseract = new IronTesseract();
ocrTesseract.Language = OcrLanguage.EnglishFast;
ocrTesseract.Configuration.ReadBarCodes = false;
ocrTesseract.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.Auto;
// --- 1. Define folder and get files ---
string folderPath = @"images"; // IMPORTANT: Set this to your image directory
string filePattern = "*.png"; // Change to "*.jpg", "*.bmp", etc. as needed
string outputFilePath = "ocr_results.txt"; // The new results file
// Get all image files in the directory
var imageFiles = Directory.GetFiles(folderPath, filePattern);
Console.WriteLine($"Found {imageFiles.Length} total images to process...");
Console.WriteLine($"Results will be written to: {outputFilePath}");
// --- 2. Start timer and process images, writing to file ---
// Open the output file *before* the loop for efficiency
using (StreamWriter writer = new StreamWriter(outputFilePath))
{
var stopwatch = Stopwatch.StartNew();
foreach (var file in imageFiles)
{
string fileName = Path.GetFileName(file);
using var ocrInput = new OcrInput();
ocrInput.LoadImage(file);
var ocrResult = ocrTesseract.Read(ocrInput);
// Check if any text was actually found
if (!string.IsNullOrEmpty(ocrResult.Text))
{
// Write to Console
Console.WriteLine($"--- Text found in: {fileName} ---");
Console.WriteLine(ocrResult.Text.Trim());
Console.WriteLine("------------------------------------------");
// Write to File
writer.WriteLine($"--- Text found in: {fileName} ---");
writer.WriteLine(ocrResult.Text.Trim());
writer.WriteLine("------------------------------------------");
writer.WriteLine(); // Add a blank line for readability
}
else
{
// Write to Console
Console.WriteLine($"No text found in: {fileName}");
// Write to File
writer.WriteLine($"No text found in: {fileName}");
writer.WriteLine();
}
}
stopwatch.Stop();
// --- 3. Print and write final benchmark summary ---
string lineSeparator = "\n========================================";
string title = "Batch OCR Processing Complete";
string summary = $"Fast configuration took {stopwatch.Elapsed.TotalSeconds:F2} seconds";
// Write summary to Console
Console.WriteLine(lineSeparator);
Console.WriteLine(title);
Console.WriteLine("========================================");
Console.WriteLine(summary);
// Write summary to File
writer.WriteLine(lineSeparator);
writer.WriteLine(title);
writer.WriteLine("========================================");
writer.WriteLine(summary);
if (imageFiles.Length > 0)
{
string avgTime = $"Average time per image: {(stopwatch.Elapsed.TotalSeconds / (double)imageFiles.Length):F3} seconds";
Console.WriteLine(avgTime);
writer.WriteLine(avgTime);
}
}
Console.WriteLine($"\nSuccessfully saved results to {outputFilePath}");Imports IronOcr
Imports System
Imports System.Diagnostics
Imports System.IO
' --- Tesseract Engine Setup ---
Dim ocrTesseract As New IronTesseract()
ocrTesseract.Language = OcrLanguage.EnglishFast
ocrTesseract.Configuration.ReadBarCodes = False
ocrTesseract.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.Auto
' --- 1. Define folder and get files ---
Dim folderPath As String = "images" ' IMPORTANT: Set this to your image directory
Dim filePattern As String = "*.png" ' Change to "*.jpg", "*.bmp", etc. as needed
Dim outputFilePath As String = "ocr_results.txt" ' The new results file
' Get all image files in the directory
Dim imageFiles = Directory.GetFiles(folderPath, filePattern)
Console.WriteLine($"Found {imageFiles.Length} total images to process...")
Console.WriteLine($"Results will be written to: {outputFilePath}")
' --- 2. Start timer and process images, writing to file ---
' Open the output file *before* the loop for efficiency
Using writer As New StreamWriter(outputFilePath)
Dim stopwatch = Stopwatch.StartNew()
For Each file In imageFiles
Dim fileName As String = Path.GetFileName(file)
Using ocrInput As New OcrInput()
ocrInput.LoadImage(file)
Dim ocrResult = ocrTesseract.Read(ocrInput)
' Check if any text was actually found
If Not String.IsNullOrEmpty(ocrResult.Text) Then
' Write to Console
Console.WriteLine($"--- Text found in: {fileName} ---")
Console.WriteLine(ocrResult.Text.Trim())
Console.WriteLine("------------------------------------------")
' Write to File
writer.WriteLine($"--- Text found in: {fileName} ---")
writer.WriteLine(ocrResult.Text.Trim())
writer.WriteLine("------------------------------------------")
writer.WriteLine() ' Add a blank line for readability
Else
' Write to Console
Console.WriteLine($"No text found in: {fileName}")
' Write to File
writer.WriteLine($"No text found in: {fileName}")
writer.WriteLine()
End If
End Using
Next
stopwatch.Stop()
' --- 3. Print and write final benchmark summary ---
Dim lineSeparator As String = vbLf & "========================================"
Dim title As String = "Batch OCR Processing Complete"
Dim summary As String = $"Fast configuration took {stopwatch.Elapsed.TotalSeconds:F2} seconds"
' Write summary to Console
Console.WriteLine(lineSeparator)
Console.WriteLine(title)
Console.WriteLine("========================================")
Console.WriteLine(summary)
' Write summary to File
writer.WriteLine(lineSeparator)
writer.WriteLine(title)
writer.WriteLine("========================================")
writer.WriteLine(summary)
If imageFiles.Length > 0 Then
Dim avgTime As String = $"Average time per image: {(stopwatch.Elapsed.TotalSeconds / CDbl(imageFiles.Length)):F3} seconds"
Console.WriteLine(avgTime)
writer.WriteLine(avgTime)
End If
End Using
Console.WriteLine(vbLf & $"Successfully saved results to {outputFilePath}")This benchmark code demonstrates several important concepts:
- Batch Processing: The code processes multiple images in a single operation, similar to our multithreaded OCR example, which shows how to leverage parallel processing for even greater speed improvements. The two settings work on different axes and combine well: fast configuration trades a little accuracy for speed, while
MaxDegreeOfParallelismtrades throughput for a smaller memory footprint. - Performance Measurement: Using the
Stopwatchclass provides accurate timing measurements down to milliseconds, essential for comparing different configurations. - Result Logging: Both console and file output ensure you can analyze the results later and verify accuracy differences between configurations.
What Performance Gains Can I Expect?
| Mode | Total Time | Avg. Time / Image | Time Gain vs. Standard | Accuracy Gain vs. Standard |
|---|---|---|---|---|
| Standard | 10.40 s | 1.040 s | Baseline | Baseline |
| Fast | 8.60 s | 0.860 s | +17.31% (Faster) | +0% (Identical) |
The benchmark comparison between standard and fast configurations shows a significant performance advantage for fast configuration. By establishing the standard mode as the baseline (10.40 seconds total time), fast configuration completed the same batch of 10 images in just 8.60 seconds. This represents a time gain of 17.31% in this test. Crucially, for these clear, high-contrast samples the speed improvement did not compromise quality - both configurations produced identical text output. Note that EnglishFast may reduce accuracy on lower-quality or noisy inputs.
To verify the results, you can download both the fast text output and the standard text output.
When Should I Use Fast Configuration?
Fast configuration is particularly beneficial for:
- High-volume document processing where thousands of pages need quick processing
- Real-time applications where response time is critical
- Web applications that need to maintain responsive user experiences
- Batch processing systems that run on tight schedules
For more complex scenarios involving multiple languages, low-quality scans, or specialized document types like license plates or passports, you may want to use standard configuration to ensure maximum accuracy.
IronOCR makes switching between configurations simple - just change a few properties and your application can adapt to different performance requirements without major code changes.
Frequently Asked Questions
What is the main benefit of using IronOCR's fast configuration in C#?
The primary benefit of using IronOCR's fast configuration is a performance improvement of approximately 17%, as shown in benchmark tests. This is achieved with minimal impact on accuracy, making it ideal for high-volume OCR tasks where speed is critical.
How does IronOCR's EnglishFast mode enhance OCR processing speed?
IronOCR's EnglishFast mode prioritizes speed by simplifying language processing. It enables faster text extraction with a slight trade-off in accuracy, which is negligible for clear, high-contrast text.
Why should you disable unnecessary features like barcode reading in fast configuration?
Disabling unnecessary features like barcode reading in IronOCR's fast configuration reduces the processing overhead, allowing the OCR engine to focus solely on text extraction, thereby speeding up the entire process.
What types of applications benefit most from IronOCR's fast configuration?
Applications that benefit most from fast configuration include high-volume document processing, real-time systems, web applications requiring rapid responses, and batch processing systems with tight schedules.
How does IronOCR maintain accuracy while boosting speed with fast configuration?
IronOCR maintains accuracy by optimizing language processing with EnglishFast mode and focusing on text areas while extracting information, ensuring that high-contrast text is accurately read even at faster speeds.
What are the steps involved in setting up IronOCR's fast configuration?
To set up IronOCR's fast configuration: install the OCR library via NuGet, initialize the OCR engine, set the Language to EnglishFast, disable the ReadBarCodes property, and proceed with loading and processing images.
Can IronOCR's fast configuration handle batch processing efficiently?
Yes, IronOCR's fast configuration is designed for efficient batch processing, allowing multiple images to be processed in a single operation with enhanced speed due to reduced computational load per image.
How does benchmark testing demonstrate the performance of fast configuration?
Benchmark testing with a set of sample images revealed that fast configuration can process images 17% quicker than the standard mode, demonstrating its superior speed without compromising text output accuracy.
When should the standard OCR configuration be preferred over fast configuration?
The standard OCR configuration should be used in scenarios requiring high accuracy, such as processing low-quality scans, recognizing multiple languages, or handling specialized documents like passports or license plates.
Is it easy to switch between fast and standard configurations in IronOCR?
Yes, IronOCR allows easy switching between configurations by changing a few properties, enabling swift adaptation to varying performance needs without complex code adjustments.

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.