在 IronOCR 中以不同處理方式儲存圖片
This article was translated from English: Does it need improvement?
Translated
View the article in English
如何儲存已套用不同影像處理/濾鏡效果的圖片?
請參照以下簡單的程式碼範例:
// 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
有關 IronOCR 中可用的完整影像優化濾鏡清單,請參閱 IronOCR 影像濾鏡。
MSDN 風格的類別文件 - OcrInput 方法
準備開始了嗎?
Nuget 下載 5,896,332 | 版本: 2026.5 just released

