How to Read Photos in C# with IronOCR

IronOCR's ReadPhoto method extracts text from complex photo formats like TIFF and GIF, providing structured results with text regions and confidence scores, optimized for high-quality scanned documents requiring accurate OCR processing.

When dealing with large volumes of documents, particularly scanned images like TIFF files, manually extracting text becomes time-consuming and error-prone. Optical Character Recognition (OCR) automates this process, converting text from images into digital data. OCR technology handles complex images like scanned documents and photographs, turning them into searchable, editable text. This speeds up document processing and ensures accurate data extraction.

Using OCR on formats like TIFF and GIF enables quick digitization of vast data amounts, despite their size, color depth, or compression challenges. With IronOCR's ReadPhoto function, developers extract text from images and perform advanced operations like keyword searching or converting scanned data into searchable PDFs. This technology benefits industries handling legal documents, archives, or receipts where efficient data retrieval is critical.

This tutorial demonstrates using ReadPhoto and manipulating the results object. We'll discuss when to use ReadPhoto instead of standard Read from IronOCR. For general image processing, explore reading various image formats.

To use this function, install the IronOcr.Extension.AdvancedScan package.

Quickstart: Use ReadPhoto to Extract Text from Complex Images

Get started fast: use IronOCR's ReadPhoto method on an OcrInput loaded with your image frame to extract all text and regions. It's optimized for TIFFs, GIFs and similar photo formats.

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.

    var result = new IronTesseract().ReadPhoto(new OcrInput().LoadImageFrame("photo.tiff", 0));
  3. Deploy to test on your live environment

    Start using IronOCR in your project today with a free trial
    arrow pointer

How Do I Extract Text from TIFF Images Using ReadPhoto?

Reading high-quality photo formats like TIFF and GIF is straightforward using IronOCR. First, create an OcrInput variable and load the image using LoadImageFrame. Then use the ReadPhoto method to obtain results. The multi-page TIFF OCR tutorial provides additional multi-page document examples.

Please note

  • TIFF contains multiple frames; the PageNumber parameter is required with zero-based indexing.
  • The method currently supports English, Chinese, Japanese, Korean, and Latin Alphabet.
  • Using advanced scan on .NET Framework requires x64 architecture.

What Input Format Should I Use?

Since browsers don't natively support TIFF format, download the TIFF input here. The displayed version below is converted to WEBP.

Input

How Do I Implement the ReadPhoto Method?

This implementation demonstrates extracting text and region information from a TIFF image. For more examples, see our photo reading code example.

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

// Instantiate OCR engine
var ocr = new IronTesseract();

using var inputPhoto = new OcrInput();
inputPhoto.LoadImageFrame("ocr.tiff", 0);

// Read photo
OcrPhotoResult result = ocr.ReadPhoto(inputPhoto);

// Index number refer to region order in the page
int number = result.TextRegions[0].PageNumber;

// Extract the text in the first region
string textinregion = result.TextRegions[0].TextInRegion;

//Extract the co_ordinates of the first text region
Rectangle region = result.TextRegions[0].Region;

var output = $"Text in First Region: {textinregion}\n"
             + $"Text Region:\n"
             + $"Starting X: {region.X}\n"
             + $"Starting Y: {region.Y}\n"
             + $"Region Width: {region.Width}\n"
             + $"Region Height: {region.Height}\n"
             + $"Result Confidence: {result.Confidence}\n\n"
             + $"Full Scnned Photo Text: {result.Text}";

Console.WriteLine(output);
Imports Microsoft.VisualBasic
Imports IronOcr
Imports IronSoftware.Drawing
Imports System

' Instantiate OCR engine
Private ocr = New IronTesseract()

Private inputPhoto = New OcrInput()
inputPhoto.LoadImageFrame("ocr.tiff", 0)

' Read photo
Dim result As OcrPhotoResult = ocr.ReadPhoto(inputPhoto)

' Index number refer to region order in the page
Dim number As Integer = result.TextRegions(0).PageNumber

' Extract the text in the first region
Dim textinregion As String = result.TextRegions(0).TextInRegion

'Extract the co_ordinates of the first text region
Dim region As Rectangle = result.TextRegions(0).Region

Dim output = $"Text in First Region: {textinregion}" & vbLf & $"Text Region:" & vbLf & $"Starting X: {region.X}" & vbLf & $"Starting Y: {region.Y}" & vbLf & $"Region Width: {region.Width}" & vbLf & $"Region Height: {region.Height}" & vbLf & $"Result Confidence: {result.Confidence}" & vbLf & vbLf & $"Full Scnned Photo Text: {result.Text}"

Console.WriteLine(output)
$vbLabelText   $csharpLabel

What Properties Does OcrPhotoResult Provide?

Debug output showing OCR text extraction with phone number, coordinates, and confidence score from processed image

The OcrPhotoResult class provides key properties for analyzing extracted text. For detailed information on working with OCR results, see our guide on data output and results manipulation.

Text: The extracted text from OCR input. Confidence: Statistical accuracy confidence (0-1 scale, 1 being highest). Learn more about result confidence scores. TextRegions: List of text regions with location data. Similar to defining OCR regions for targeted extraction.


When Should I Use ReadPhoto Instead of Read?

The main difference between ReadPhoto and standard Read is the result object and supported file formats. LoadImageFrame specifically accepts TIFF and GIF, not formats like JPEG. ReadPhoto is optimized for complex image formats, while standard Read suits simpler images and general text extraction tasks.

Why Does ReadPhoto Only Support TIFF and GIF Formats?

TIFF is a lossless format for condensing multiple pages and frames into one file. It's used for high-quality, multi-image storage like legal documents and medical images. Being more complex than JPEG, it requires different methods for text extraction. The specialized handling ensures optimal results with professional-grade image formats.

TIFF images use different compression methods, so IronOCR employs specialized algorithms to decipher text. The advanced algorithms in ReadPhoto handle TIFF compression characteristics, ensuring accurate extraction from complex multi-layered documents.

Here's a comparison between TIFF and JPEG formats:

FeatureTIFF (Tagged Image File Format)JPG/JPEG (Joint Photographic Experts Group)
CompressionLossless or uncompressed (preserves quality)Lossy compression (reduces quality for smaller file size)
File SizeLarge (due to high quality and optional lack of compression)Smaller, optimized for web use and fast loading
Image QualityHigh (ideal for professional use, retains all details)Lower (due to lossy compression, some quality is sacrificed)
Color DepthSupports high color depth (up to 16-bit or 32-bit per channel)24-bit color (16.7 million colors)
Use CaseProfessional photography, publishing, scanning, archivingWeb images, social media, everyday photos
TransparencySupports transparency and alpha channelsDoes not support transparency
EditingGood for multiple edits (no quality loss with resaving)Quality degrades with repeated edits and saves
CompatibilityWidely supported in professional softwareUniversally supported across all platforms and devices
AnimationDoes not support animationDoes not support animation
MetadataStores extensive metadata (EXIF, layers, etc.)Stores EXIF metadata but is more limited

How Do I Choose Between ReadPhoto and Read for My Application?

Consider each production use case to optimize application performance. While ReadPhoto suits complex TIFF images, it processes more slowly. JPEG offers faster processing but lower quality, which may result in low OCR confidence rates. Use image quality correction filters to improve results when needed.

The confidence property in OcrPhotoResults or any IOcrResult interface class indicates result accuracy, allowing developers to test and optimize. For highest accuracy requirements, ReadPhoto with high-quality TIFF images provides best results, especially for archival or legal document processing where precision matters.

Find the balance between efficiency and accuracy by ensuring images meet certain quality thresholds. For mixed document types, implement a hybrid approach: use ReadPhoto for critical documents requiring high accuracy and standard Read for routine tasks prioritizing speed.

Frequently Asked Questions

What image formats does the ReadPhoto method support?

IronOCR's ReadPhoto method is optimized for complex photo formats like TIFF and GIF. It's specifically designed to extract text from high-quality scanned documents and photographs, providing structured results with text regions and confidence scores.

How do I extract text from a TIFF image?

To extract text from TIFF images using IronOCR, create an OcrInput variable, load the image using LoadImageFrame, then apply the ReadPhoto method. The process is straightforward: var result = new IronTesseract().ReadPhoto(new OcrInput().LoadImageFrame("photo.tiff", 0));

What additional package is required to use the ReadPhoto function?

To use the ReadPhoto function in IronOCR, you need to install the IronOcr.Extension.AdvancedScan package from NuGet. This extension provides the advanced scanning capabilities required for the ReadPhoto method.

When should I use ReadPhoto instead of the standard Read method?

Use IronOCR's ReadPhoto method when dealing with complex photo formats like TIFF and GIF, particularly for high-quality scanned documents requiring accurate OCR processing. The standard Read method is better suited for general image processing tasks.

What kind of results does ReadPhoto provide?

IronOCR's ReadPhoto method provides structured OCR results that include extracted text regions with confidence scores. You can access these through the OcrPhotoResult property to view and manipulate the extracted data.

Can ReadPhoto handle multi-page documents?

Yes, IronOCR's ReadPhoto method can process multi-page documents, especially TIFF files which often contain multiple frames. The LoadImageFrame method allows you to specify which frame to process in multi-page documents.

What industries benefit from using OCR technology for photos?

IronOCR benefits industries handling legal documents, archives, receipts, and any business dealing with large volumes of scanned documents where efficient data retrieval is critical. The ReadPhoto method automates text extraction from these complex image formats.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More
Ready to Get Started?
Nuget Downloads 5,219,969 | Version: 2025.12 just released