Skip to footer content

Preprocessing

Improve input from low-quality scans and photos. Use our preprocessing filters to clean, straighten, and enhance difficult images for maximum OCR accuracy.

Icon Main related to Preprocessing
Input Color Correction Filters

1

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");
C#
2

Grayscale

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");
C#
3

Change 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");
C#

Icon Main related to Preprocessing
Input Morphological Operations

1

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 Reading
using 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");
C#
2

Erodes

Thin the characters in an image, useful for separating characters that are touching or bleeding together.

Learn how to:Correct Image Using Filters for Reading
using 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");
C#
3

Change 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");
C#

Icon Main related to Preprocessing
Input Orientation Manipulation

1

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();
C#
2

Rotate

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");
C#
3

Detect 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 Rotation
using 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);
}
C#

Icon Main related to Preprocessing
Input Resolution Control

1

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");
C#
2

DPI 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 DPI
using 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);
C#
3

Enhanced 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 Reading
using 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");
C#
4

Filter 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 Wizard
using 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);
C#
5

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);
C#
Ready to Get Started?
Nuget Downloads 5,058,051 | Version: 2025.11 just released