Save Images with Different Processing in IronOCR

This article was translated from English: Does it need improvement?
Translated
View the article in English

How can I save an image with different image processing/image filters applied?

Apply the following simple code example:

// Create a new instance of OcrInput from a text box input for file path.
OcrInput input = new OcrInput(browsFile_txt.Text);

// Apply a grayscale filter to the image.
input.ToGrayScale();

// Iterate through each page in the OcrInput object.
foreach (var p in input.Pages)
{
    // Save each processed page as an image with a unique timestamped filename.
    p.SaveAsImage($"{outputPath}\\{DateTime.Now.ToString("yyyyMMddHHmmss")}.png");
}
// Create a new instance of OcrInput from a text box input for file path.
OcrInput input = new OcrInput(browsFile_txt.Text);

// Apply a grayscale filter to the image.
input.ToGrayScale();

// Iterate through each page in the OcrInput object.
foreach (var p in input.Pages)
{
    // Save each processed page as an image with a unique timestamped filename.
    p.SaveAsImage($"{outputPath}\\{DateTime.Now.ToString("yyyyMMddHHmmss")}.png");
}
' Create a new instance of OcrInput from a text box input for file path.
Dim input As New OcrInput(browsFile_txt.Text)

' Apply a grayscale filter to the image.
input.ToGrayScale()

' Iterate through each page in the OcrInput object.
For Each p In input.Pages
	' Save each processed page as an image with a unique timestamped filename.
	p.SaveAsImage($"{outputPath}\{DateTime.Now.ToString("yyyyMMddHHmmss")}.png")
Next p
$vbLabelText   $csharpLabel

For a full list of image optimization filters available in IronOCR, see IronOCR Image Filters.

MSDN-Style Class Documentation - OcrInput Methods

Curtis Chau
Escritor Técnico

Curtis Chau tiene una licenciatura en Ciencias de la Computación (Carleton University) y se especializa en el desarrollo front-end con experiencia en Node.js, TypeScript, JavaScript y React. Apasionado por crear interfaces de usuario intuitivas y estéticamente agradables, disfruta trabajando con frameworks modernos y creando manuales bien ...

Leer más
¿Listo para empezar?
Nuget Descargas 5,044,537 | Versión: 2025.11 recién lanzado