Fast OCR Configuration in C# for Optimal Performance

IronOCR's fast configuration enables up to 17% faster OCR processing speeds without accuracy loss 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.

Get started with IronOCR


Quickstart: Configure Fast OCR in C#

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?

Moby Dick opening text displayed in white on dark background showing Ishmael's introduction

What Code Do I Need for Fast Configuration?

Nuget IconGet started making PDFs with NuGet now:

  1. Install IronOCR with NuGet Package Manager

    PM > Install-Package IronOcr

  2. Copy 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);
  3. Deploy to test on your live environment

    Start using IronOCR in your project today with a free trial
    arrow pointer

What Output Can I Expect?

Visual Studio editor displaying opening passage from Moby Dick novel

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?

:path=/static-assets/ocr/content-code-examples/how-to/ocr-fast-configuration-benchmark.cs
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}");
$vbLabelText   $csharpLabel

This benchmark code demonstrates several important concepts:

  1. 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.

  2. Performance Measurement: Using the Stopwatch class provides accurate timing measurements down to milliseconds, essential for comparing different configurations.

  3. 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?

ModeTotal TimeAvg. Time / ImageTime Gain vs. StandardAccuracy Gain vs. Standard
Standard10.40 s1.040 sBaselineBaseline
Fast8.60 s0.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 substantial time gain of 17.31%. Crucially, this speed improvement did not compromise quality; the accuracy was identical between both modes, with both configurations producing the same text output.

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

How much faster is the fast OCR configuration compared to standard settings?

IronOCR's fast configuration can achieve up to 17% faster processing speeds compared to standard OCR settings, with minimal impact on accuracy. This performance gain is achieved through the EnglishFast language mode and by disabling unnecessary features.

What is the main setting that enables fast OCR processing?

The main component for fast configuration in IronOCR is setting the Language property to OcrLanguage.EnglishFast. This prioritizes speed over a small potential cost in accuracy, making it ideal for bulk processing and time-critical applications.

How can I further optimize OCR speed beyond using EnglishFast mode?

You can gain additional speed improvements by disabling unnecessary features in IronOCR, such as setting ReadBarCodes to false if you don't need barcode detection. Also, let IronOCR auto-detect page segmentation by using TesseractPageSegmentationMode.Auto.

When should I use fast OCR configuration instead of standard settings?

Fast OCR configuration in IronOCR is ideal for high-volume processing scenarios where time is critical and a slight trade-off in accuracy is acceptable. It's particularly useful for mission-critical applications that need to process scanned documents, PDFs, or images quickly.

Does fast configuration work with all document types?

Yes, IronOCR's fast configuration works effectively with various document types including scanned documents, PDFs, and images. The optimization benefits apply regardless of the input format you're processing.

Is there any loss of accuracy when using fast OCR mode?

IronOCR's fast configuration provides significant scanning performance gains with minimal accuracy impact. While there may be a small potential cost in accuracy when using EnglishFast mode, the trade-off is often worth it for applications that prioritize speed.

Curtis Chau
Technical Writer

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.

...

Read More
Ready to Get Started?
Nuget Downloads 5,269,558 | Version: 2025.12 just released