How to Read Multi-Frame/Page GIFs and TIFFs

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

TIFF (標記圖像文件格式) 是一種用於高品質圖像的流行格式。 它支持無損壓縮,使其適合於需要保持原始質量的圖像,如掃描文檔或專業攝影。

GIF (圖形交換格式) 是一種主要用於簡單的、網頁友好的圖像和動畫的格式。 GIF 支持無損和有損壓縮。 它以能夠在單一文件中包含動畫而聞名,因此在網站和消息應用中經常用於短的、迴圈動畫。

標題:2(快速入門: 使用多幀 TIFF 或 GIF 文件進行 OCR)

看看使用 IronOCR 從多頁 TIFF 或動畫 GIF 中讀取文本是多麼簡單。 只需使用 OcrImageInputRead 調用——不需要複雜的設置。

Nuget IconGet started making PDFs with NuGet now:

  1. Install IronOCR with NuGet Package Manager

    PM > Install-Package IronOcr

  2. Copy and run this code snippet.

    using IronOcr;
    var result = new IronTesseract().Read(new OcrImageInput("Potter.tiff"));
  3. Deploy to test on your live environment

    Start using IronOCR in your project today with a free trial
    arrow pointer
class="hsg-featured-snippet">

最低限度的工作流程(5 步)

  1. 下載一個用於讀取多幀 GIF 和 TIFF 的 C# 庫
  2. 利用 OcrImageInput 類來導入單幀/多幀 TIFF
  3. 使用 Read 方法來執行 OCR
  4. 使用相同的類來導入 GIF 圖像
  5. 通過指定裁切區域來定義讀取區域


讀取單幀/多幀 TIFF 示例

要執行 OCR,首先實例化 IronTesseract 類。 使用 using 語句創建 OcrImageInput 對象。 此構造函數支持單幀和多幀 TIFF 和 TIF 格式。 最後,應用 Read 方法對導入的 TIFF 文件進行 OCR。

:path=/static-assets/ocr/content-code-examples/how-to/input-tiff-gif-read-tiff.cs
using IronOcr;

// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();

// Import TIFF/TIF
using var imageInput = new OcrImageInput("Potter.tiff");
// Perform OCR
OcrResult ocrResult = ocrTesseract.Read(imageInput);
Imports IronOcr

' Instantiate IronTesseract
Private ocrTesseract As New IronTesseract()

' Import TIFF/TIF
Private imageInput = New OcrImageInput("Potter.tiff")
' Perform OCR
Private ocrResult As OcrResult = ocrTesseract.Read(imageInput)
$vbLabelText   $csharpLabel
class="content-img-align-center">
class="center-image-wrapper"> 讀取 TIFF 圖像

讀取 GIF 示例

同樣,只需在構造 OcrImageInput 類時指定 GIF 文件路徑。 構造函數將處理所有必要的步驟以導入圖像。

:path=/static-assets/ocr/content-code-examples/how-to/input-tiff-gif-read-gif.cs
using IronOcr;

// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();

// Import GIF
using var imageInput = new OcrImageInput("Potter.gif");
// Perform OCR
OcrResult ocrResult = ocrTesseract.Read(imageInput);
Imports IronOcr

' Instantiate IronTesseract
Private ocrTesseract As New IronTesseract()

' Import GIF
Private imageInput = New OcrImageInput("Potter.gif")
' Perform OCR
Private ocrResult As OcrResult = ocrTesseract.Read(imageInput)
$vbLabelText   $csharpLabel

指定掃描區域

您可以在構造 OcrImageInput 類時包含 CropRectangle 對象,允許您定義圖像文件中的特定區域以進行 OCR。 這可以大大提高性能,特別是對於大型圖像文件。

:path=/static-assets/ocr/content-code-examples/how-to/input-images-read-specific-region.cs
using IronOcr;
using IronSoftware.Drawing;
using System;

// Instantiate IronTesseract
IronTesseract ocrTesseract = new IronTesseract();

// Specify crop region
Rectangle scanRegion = new Rectangle(800, 200, 900, 400);

// Add image
using var imageInput = new OcrImageInput("Potter.tiff", ContentArea: scanRegion);
// Perform OCR
OcrResult ocrResult = ocrTesseract.Read(imageInput);

// Output the result to console
Console.WriteLine(ocrResult.Text);
Imports IronOcr
Imports IronSoftware.Drawing
Imports System

' Instantiate IronTesseract
Private ocrTesseract As New IronTesseract()

' Specify crop region
Private scanRegion As New Rectangle(800, 200, 900, 400)

' Add image
Private imageInput = New OcrImageInput("Potter.tiff", ContentArea:= scanRegion)
' Perform OCR
Private ocrResult As OcrResult = ocrTesseract.Read(imageInput)

' Output the result to console
Console.WriteLine(ocrResult.Text)
$vbLabelText   $csharpLabel

OCR 結果

class="content-img-align-center">
class="center-image-wrapper"> 閱讀特定區域

常見問題解答

如何使用 C# 讀取多幀 GIF 和 TIFF 影像?

您可以使用 IronOCR 庫讀取多幀 GIF 和 TIFF 影像。從 NuGet 下載該程式庫,使用OcrImageInput類別匯入映像,然後套用Read方法執行 OCR 操作。

使用TIFF格式儲存影像有哪些好處?

TIFF 格式有利於需要高品質和無損壓縮的影像,因此非常適合掃描文件和專業攝影,因為在這些應用中保持原始品質非常重要。

為什麼GIF格式常用於動畫?

GIF格式因其能在單一檔案中儲存多張影像而廣受動畫愛好者的青睞,從而能夠製作短小精悍、循環播放的動畫,非常適合網站和即時通訊應用。它同時支援無損壓縮和有損壓縮。

如何使用 IronOCR 在影像中指定 OCR 區域?

在 IronOCR 中,您可以使用CropRectangle物件在建構OcrImageInput類別時指定 OCR 區域。這樣,您可以將 OCR 工作集中在影像中的特定區域。

IronOCR 中 OcrImageInput 類別的作用是什麼?

IronOCR 中的OcrImageInput類別用於導入單幀和多幀 TIFF 和 GIF 影像進行 OCR 處理,因此可以從這些格式中提取文字。

如何提高OCR對大型影像文件的處理效能?

為了提高大型影像文件的 OCR 效能,可以使用CropRectangle物件在影像中定義特定的掃描區域。這樣可以將 OCR 功能集中在指定區域,從而提高效率。

使用 IronOCR 辨識 GIF 影像需要哪些步驟?

若要使用 IronOCR 處理 GIF 影像,請在建立OcrImageInput類別時指定 GIF 檔案路徑。然後,使用Read方法從圖像中提取文字。

IronTesseract 如何促進 OCR 過程?

IronTesseract 是 IronOCR 中的一個類,它啟動並執行圖像檔案的 OCR 過程,支援多幀 TIFF 和 GIF 等格式,並實現高效的文本提取。

A PHP Error was encountered

Severity: Warning

Message: Illegal string offset 'name'

Filename: sections/author_component.php

Line Number: 18

Backtrace:

File: /var/www/ironpdf.com/application/views/main/sections/author_component.php
Line: 18
Function: _error_handler

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 63
Function: view

File: /var/www/ironpdf.com/application/views/products/sections/three_column_docs_page_structure.php
Line: 64
Function: main_view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 88
Function: view

File: /var/www/ironpdf.com/application/views/products/how-to/index.php
Line: 2
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 88
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 552
Function: view

File: /var/www/ironpdf.com/application/controllers/Products/Howto.php
Line: 31
Function: render_products_view

File: /var/www/ironpdf.com/index.php
Line: 292
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: Illegal string offset 'title'

Filename: sections/author_component.php

Line Number: 38

Backtrace:

File: /var/www/ironpdf.com/application/views/main/sections/author_component.php
Line: 38
Function: _error_handler

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 63
Function: view

File: /var/www/ironpdf.com/application/views/products/sections/three_column_docs_page_structure.php
Line: 64
Function: main_view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 88
Function: view

File: /var/www/ironpdf.com/application/views/products/how-to/index.php
Line: 2
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 88
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 552
Function: view

File: /var/www/ironpdf.com/application/controllers/Products/Howto.php
Line: 31
Function: render_products_view

File: /var/www/ironpdf.com/index.php
Line: 292
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: Illegal string offset 'comment'

Filename: sections/author_component.php

Line Number: 48

Backtrace:

File: /var/www/ironpdf.com/application/views/main/sections/author_component.php
Line: 48
Function: _error_handler

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 63
Function: view

File: /var/www/ironpdf.com/application/views/products/sections/three_column_docs_page_structure.php
Line: 64
Function: main_view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 88
Function: view

File: /var/www/ironpdf.com/application/views/products/how-to/index.php
Line: 2
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 88
Function: view

File: /var/www/ironpdf.com/application/libraries/Render.php
Line: 552
Function: view

File: /var/www/ironpdf.com/application/controllers/Products/Howto.php
Line: 31
Function: render_products_view

File: /var/www/ironpdf.com/index.php
Line: 292
Function: require_once

準備好開始了嗎?
Nuget 下載 5,044,537 | 版本: 2025.11 剛剛發布