Preprocessing
Improve input from low-quality scans and photos. Use our preprocessing filters to clean, straighten, and enhance difficult images for maximum OCR accuracy.
Input Color Correction Filters
Binarized
Easily binarize your input directly within IronOCR, transforming images into sharp black-and-white versions. This filter effectively isolates text from complex backgrounds, reducing noise and making text extraction easier and more reliable.
Learn how to:Fix Image Colors for Reading in .NET C#using IronOcr;
// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();
// Add image
using var imageInput = new OcrImageInput("sample.jpg");
// Apply binarize affect
imageInput.Binarize();
// Export the modified image
imageInput.SaveAsImages("binarize.jpg");Imports IronOcr
' Instantiate IronTesseract
Dim ocrTesseract As New IronTesseract()
' Add image
Using imageInput As New OcrImageInput("sample.jpg")
' Apply binarize affect
imageInput.Binarize()
' Export the modified image
imageInput.SaveAsImages("binarize.jpg")
End UsingGrayscale
Convert a color image to grayscale - a crucial step in preparing images for more advanced preprocessing filters.
Learn how to:Fix Image Colors for Reading in .NET C#using IronOcr;
// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();
// Add image
using var imageInput = new OcrImageInput("sample.jpg");
// Apply grayscale affect
imageInput.ToGrayScale();
// Export the modified image
imageInput.SaveAsImages("grayscale.jpg");Imports IronOcr
' Instantiate IronTesseract
Dim ocrTesseract As New IronTesseract()
' Add image
Using imageInput As New OcrImageInput("sample.jpg")
' Apply grayscale affect
imageInput.ToGrayScale()
' Export the modified image
imageInput.SaveAsImages("grayscale.jpg")
End UsingChange pixel colors
Replace specific color ranges in an image, allowing you to remove watermarks, colored backgrounds, or other distracting elements before OCR.
Learn how to:Fix Image Colors for Reading in .NET C#using IronOcr;
// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();
// Add image
using var imageInput = new OcrImageInput("sample.jpg");
IronSoftware.Drawing.Color currentColor = new IronSoftware.Drawing.Color("#DB645C");
IronSoftware.Drawing.Color newColor = IronSoftware.Drawing.Color.DarkCyan;
// Replace color
imageInput.ReplaceColor(currentColor, newColor, 80);
// Export the modified image
imageInput.SaveAsImages("replaceColor");Imports IronOcr
' Instantiate IronTesseract
Dim ocrTesseract As New IronTesseract()
' Add image
Using imageInput As New OcrImageInput("sample.jpg")
Dim currentColor As New IronSoftware.Drawing.Color("#DB645C")
Dim newColor As IronSoftware.Drawing.Color = IronSoftware.Drawing.Color.DarkCyan
' Replace color
imageInput.ReplaceColor(currentColor, newColor, 80)
' Export the modified image
imageInput.SaveAsImages("replaceColor")
End Using
Input Morphological Operations
Dilates
Thicken the characters in an image, which can help connect broken lines in text and improve recognition of faint or thin fonts.
Learn how to:Correct Image Using Filters for Readingusing IronOcr;
// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();
// Add image
using var imageInput = new OcrImageInput("sample.jpg");
// Apply Dilate filter
imageInput.Dilate();
// Export filtered image
imageInput.SaveAsImages("dilate.jpg");Imports IronOcr
' Instantiate IronTesseract
Dim ocrTesseract As New IronTesseract()
' Add image
Using imageInput As New OcrImageInput("sample.jpg")
' Apply Dilate filter
imageInput.Dilate()
' Export filtered image
imageInput.SaveAsImages("dilate.jpg")
End UsingErodes
Thin the characters in an image, useful for separating characters that are touching or bleeding together.
Learn how to:Correct Image Using Filters for Readingusing IronOcr;
// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();
// Add image
using var imageInput = new OcrImageInput("sample.jpg");
// Apply Erode filter
imageInput.Erode();
// Export filtered image
imageInput.SaveAsImages("erode.jpg");Imports IronOcr
' Instantiate IronTesseract
Dim ocrTesseract As New IronTesseract()
' Add image
Using imageInput As New OcrImageInput("sample.jpg")
' Apply Erode filter
imageInput.Erode()
' Export filtered image
imageInput.SaveAsImages("erode.jpg")
End UsingChange pixel colors
Replace specific color ranges in an image, allowing you to remove watermarks, colored backgrounds, or other distracting elements before OCR.
Learn how to:Fix Image Colors for Reading in .NET C#using IronOcr;
// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();
// Add image
using var imageInput = new OcrImageInput("sample.jpg");
IronSoftware.Drawing.Color currentColor = new IronSoftware.Drawing.Color("#DB645C");
IronSoftware.Drawing.Color newColor = IronSoftware.Drawing.Color.DarkCyan;
// Replace color
imageInput.ReplaceColor(currentColor, newColor, 80);
// Export the modified image
imageInput.SaveAsImages("replaceColor");Imports IronOcr
' Instantiate IronTesseract
Dim ocrTesseract As New IronTesseract()
' Add image
Using imageInput As New OcrImageInput("sample.jpg")
Dim currentColor As New IronSoftware.Drawing.Color("#DB645C")
Dim newColor As IronSoftware.Drawing.Color = IronSoftware.Drawing.Color.DarkCyan
' Replace color
imageInput.ReplaceColor(currentColor, newColor, 80)
' Export the modified image
imageInput.SaveAsImages("replaceColor")
End Using
Input Orientation Manipulation
Deskew
Automatically detect and straighten skewed or tilted images, dramatically improving OCR accuracy on imperfect scans.
Learn how to:Fix Image Orientation for Reading in .NET C#using IronOcr;
// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();
// Add image
using var imageInput = new OcrImageInput("paragraph_skewed.png");
// Apply Deskew filter
imageInput.Deskew();Imports IronOcr
' Instantiate IronTesseract
Dim ocrTesseract As New IronTesseract()
' Add image
Using imageInput As New OcrImageInput("paragraph_skewed.png")
' Apply Deskew filter
imageInput.Deskew()
End UsingRotate
Programmatically rotate images by any degree to ensure text is correctly oriented for the OCR engine.
Learn how to:Fix Image Orientation for Reading in .NET C#using IronOcr;
// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();
// Add image
using var imageInput = new OcrImageInput("paragraph_skewed.png");
// Rotate the image 180 degrees clockwise
imageInput.Rotate(180);
// Export the modified image
imageInput.SaveAsImages("rotate");Imports IronOcr
' Instantiate IronTesseract
Dim ocrTesseract As New IronTesseract()
' Add image
Using imageInput = New OcrImageInput("paragraph_skewed.png")
' Rotate the image 180 degrees clockwise
imageInput.Rotate(180)
' Export the modified image
imageInput.SaveAsImages("rotate")
End UsingDetect Orientation
Automatically determine page orientation (0, 90, 180, 270 degrees), useful for the orientation correction before OCR. Ensures high accuracy even when documents are scanned upside down.
Learn how to:Detect Page Rotationusing IronOcr;
using var input = new OcrInput();
// Load PDF document
input.LoadPdf("Clockwise90.pdf");
// Detect page rotation
var results = input.DetectPageOrientation();
// Ouput result
foreach(var result in results)
{
Console.WriteLine(result.PageNumber);
Console.WriteLine(result.HighConfidence);
Console.WriteLine(result.RotationAngle);
}Imports IronOcr
Dim Input As New OcrInput()
' Load PDF document
Input.LoadPdf("Clockwise90.pdf")
' Detect page rotation
Dim Results = Input.DetectPageOrientation()
' Output result
For Each Result In Results
Console.WriteLine(Result.PageNumber)
Console.WriteLine(Result.HighConfidence)
Console.WriteLine(Result.RotationAngle)
Next
Input Resolution Control
Scale
Resize an image to an optimal resolution for OCR, significantly boosting accuracy on low-resolution source files.
Learn how to:Fix Image Orientation for Reading in .NET C#using IronOcr;
// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();
// Add image
using var imageInput = new OcrImageInput("paragraph_skewed.png");
// Apply scale
imageInput.Scale(70);
// Export the modified image
imageInput.SaveAsImages("rotate");Imports IronOcr
' Instantiate IronTesseract
Dim ocrTesseract As New IronTesseract()
' Add image
Using imageInput As New OcrImageInput("paragraph_skewed.png")
' Apply scale
imageInput.Scale(70)
' Export the modified image
imageInput.SaveAsImages("rotate")
End UsingDPI setting
Manually set the Dots Per Inch (DPI) for low-resolution images or scans where metadata is missing. Providing a DPI value guides the OCR engine and significantly boosts recognition quality.
Learn how to:C# Tesseract Image DPIusing IronOcr;
using System;
var ocrTesseract = new IronTesseract();
using var ocrInput = new OcrInput();
ocrInput.TargetDPI = 300;
ocrInput.LoadImage(@"images\image.png");
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);Imports IronOcr
Imports System
Dim ocrTesseract = New IronTesseract()
Using ocrInput = New OcrInput()
ocrInput.TargetDPI = 300
ocrInput.LoadImage("images\image.png")
Dim ocrResult = ocrTesseract.Read(ocrInput)
Console.WriteLine(ocrResult.Text)
End UsingEnhanced Resolution
Algorithmically improve the sharpness and clarity of low-resolution images to rescue text from blurry or pixelated inputs.
Learn how to:Correct Image Using Filters for Readingusing IronOcr;
// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();
// Add image
using var imageInput = new OcrImageInput("sample.jpg");
// Apply enhance resolution filter
imageInput.EnhanceResolution();
// Export filtered image
imageInput.SaveAsImages("sharpen.jpg");Imports IronOcr
' Instantiate IronTesseract
Dim ocrTesseract As New IronTesseract()
' Add image
Using imageInput As New OcrImageInput("sample.jpg")
' Apply enhance resolution filter
imageInput.EnhanceResolution()
' Export filtered image
imageInput.SaveAsImages("sharpen.jpg")
End UsingFilter Wizard
Apply a curated chain of preprocessing filters using a single, intelligent method. The Filter Wizard automatically analyzes the input image and applies an optimal sequence of corrections to achieve the best possible OCR results.
Learn how to:Filter Wizardusing IronOcr;
var ocrTesseract = new IronTesseract();
// WIZARD - If you are unsure which filters to use,
// use the debug-wizard to test all combinations:
string codeToRun = OcrInputFilterWizard.Run(@"images\image.png", out double confidence, ocrTesseract);
Console.WriteLine($"Confidence: {confidence}");
Console.WriteLine(codeToRun);Imports IronOcr
Dim ocrTesseract = New IronTesseract()
' WIZARD - If you are unsure which filters to use,
' use the debug-wizard to test all combinations:
Dim confidence As Double
Dim codeToRun As String = OcrInputFilterWizard.Run("images\image.png", confidence, ocrTesseract)
Console.WriteLine($"Confidence: {confidence}")
Console.WriteLine(codeToRun)OCR a Region of an image
Save processing time by targeting only the specific area of an image that contains text. Simply define a rectangular region to isolate and extract text from forms, tables, or cluttered backgrounds.
Learn how to:Tesseract OCR Specifc Area of an Image in C#using IronOcr;
using IronSoftware.Drawing;
var ocrTesseract = new IronTesseract();
using var ocrInput = new OcrInput();
var ContentArea = new Rectangle(x: 215, y: 1250, width: 1335, height: 280);
ocrInput.LoadImage("img/example.png", ContentArea);
var ocrResult = ocrTesseract.Read(ocrInput);
Console.WriteLine(ocrResult.Text);Imports IronOcr
Imports IronSoftware.Drawing
Dim ocrTesseract = New IronTesseract()
Using ocrInput = New OcrInput()
Dim ContentArea = New Rectangle(x:=215, y:=1250, width:=1335, height:=280)
ocrInput.LoadImage("img/example.png", ContentArea)
Dim ocrResult = ocrTesseract.Read(ocrInput)
Console.WriteLine(ocrResult.Text)
End UsingReady to Get Started?
Nuget Downloads 6,236,385|Version:2026.9just released