在IronOCR中以不同處理方式保存圖片

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

我可以如何使用不同的影像處理/影像濾鏡來保存圖片?

套用以下簡單的程式碼範例:

// Create a new instance of OcrInput and load the image from a text box input for file path.
OcrInput input = new OcrInput();
input.LoadImage(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.GetPages())
{
    // 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 and load the image from a text box input for file path.
OcrInput input = new OcrInput();
input.LoadImage(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.GetPages())
{
    // 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 and load the image from a text box input for file path.
Dim input As New OcrInput()
input.LoadImage(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.GetPages()
    ' Save each processed page as an image with a unique timestamped filename.
    p.SaveAsImage($"{outputPath}\{DateTime.Now.ToString("yyyyMMddHHmmss")}.png")
Next
$vbLabelText   $csharpLabel

有關IronOCR中可用的完整影像優化濾鏡列表,請參見IronOCR影像濾鏡

MSDN風格類別文件 - OcrInput方法

Curtis Chau
技術作家

Curtis Chau擁有Carleton大學的電腦科學學士學位,專精於前端開發,擁有Node.js、TypeScript、JavaScript和React的專業知識。Curtis熱衷於建立直觀且美觀的使用者介面,喜愛使用現代框架並建立結構良好、視覺吸引力的手冊。

除了開發,Curtis對物聯網(IoT)有濃厚的興趣,探索創新的方法來整合硬體和軟體。在空閒時間,他喜歡玩遊戲和建立Discord機器人,結合他對技術的熱愛與創造力。

準備開始了嗎?
Nuget 下載 6,136,090 | 版本: 2026.7 剛剛發布
Still Scrolling Icon

還在滾動?

想要快速證明? PM > Install-Package IronOcr
執行範例 觀看您的圖像轉變為可搜尋文字。