IRONSOFTWAREHOME
OCR Image Optimization Filters
using IronOcr;
using System;

var ocrTesseract = new IronTesseract();
using var ocrInput = new OcrInput();
// First load all image(s)
ocrInput.LoadImage(@"images\image.png");

// Note: You don't need all of them; most users only need Deskew() and occasionally DeNoise()
ocrInput.WithTitle("My Document");
ocrInput.Binarize();
ocrInput.Contrast();
ocrInput.Deskew();
ocrInput.DeNoise();
ocrInput.Despeckle();
ocrInput.Dilate();
ocrInput.EnhanceResolution(300);
ocrInput.Invert();
ocrInput.Rotate(90);
ocrInput.Scale(150);
ocrInput.Sharpen();
ocrInput.ToGrayScale();
ocrInput.Erode();

// WIZARD - If you are unsure use the debug-wizard to test all combinations:
string codeToRun = OcrInputFilterWizard.Run(@"images\image.png", out double confidence, ocrTesseract);
Console.WriteLine(codeToRun);

// Optional: Export modified images so you can view them.
foreach (var page in ocrInput.GetPages())
{
    page.SaveAsImage($"filtered_{page.Index}.bmp");
}

var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);
Imports IronOcr
Imports System

Dim ocrTesseract = New IronTesseract()
Using ocrInput = New OcrInput()
    ' First load all image(s)
    ocrInput.LoadImage("images\image.png")

    ' Note: You don't need all of them; most users only need Deskew() and occasionally DeNoise()
    ocrInput.WithTitle("My Document")
    ocrInput.Binarize()
    ocrInput.Contrast()
    ocrInput.Deskew()
    ocrInput.DeNoise()
    ocrInput.Despeckle()
    ocrInput.Dilate()
    ocrInput.EnhanceResolution(300)
    ocrInput.Invert()
    ocrInput.Rotate(90)
    ocrInput.Scale(150)
    ocrInput.Sharpen()
    ocrInput.ToGrayScale()
    ocrInput.Erode()

    ' WIZARD - If you are unsure use the debug-wizard to test all combinations:
    Dim codeToRun As String = OcrInputFilterWizard.Run("images\image.png", confidence:=Nothing, ocrTesseract)
    Console.WriteLine(codeToRun)

    ' Optional: Export modified images so you can view them.
    For Each page In ocrInput.GetPages()
        page.SaveAsImage($"filtered_{page.Index}.bmp")
    Next

    Dim ocrResult = ocrTesseract.Read(ocrInput)
    Console.WriteLine(ocrResult.Text)
End Using
NuGet Download
PM > Install-Package IronOcr
OCR Image Optimization Filters

OCR Image Optimization Filters

The OcrInput class provides granular control to C# and .NET developers to preprocess image input for speed and accuracy before OCR processing. This negates the common practice of using Photoshop Batch Scripts or ImageMagick to prepare images for OCR.

Below is an example demonstrating how to use the OcrInput class in C# with IronOCR:

Enhance Image Quality for OCR with Our Guide
View on GitHub

Ready to Get Started?

Nuget Downloads 6,279,416Version:2026.10just released

Key in blue circle

Get your free 30-day Trial Key instantly

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronOCR
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get a Quote, No Obligation
Your details will always be kept confidential.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Trusted by Millions of Engineers Worldwide
Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.10

PM > Install-Package IronOcr
nuget.org/packages/IronOcr/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronOCR"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.10

or download Windows Installer here.

  1. Download and unzip IronOCR to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronOCR.dll"

Licenses from $999