---
title: "Extracting text from images | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/csharp/extraction/read-text-from-image/"
md_url: "https://www.nutrient.io/guides/dotnet/csharp/extraction/read-text-from-image.md"
last_updated: "2026-10-08T00:00:00.000Z"
description: "Extract text from images using OCR with Nutrient .NET SDK."
---

# Extracting text from images

In modern business operations, converting image-based text into searchable, editable digital content is a critical step in workflow automation. Organizations often face the challenge of manually transcribing information from scanned documents and photographs — a process that is time-consuming and prone to human error.

This sample demonstrates the technical foundation for automated text extraction from images using Nutrient.NET SDK. It showcases how businesses can transform static visual content into actionable digital text. This capability supports complex document processing workflows, including:

- Search functionality — Making scanned documents searchable.

- Accessibility compliance — Supporting screen readers and text-to-speech.

- Automated data entry — Eliminating manual transcription in form processing.

Whether you’re digitizing historical archives or processing high volumes of form submissions, the ability to reliably extract text from images enables automation strategies that maintain accuracy and efficiency across diverse operational contexts.

## Streamlining document workflows with our.NET SDK

Developers can implement this feature by adding just a few lines of code to their applications. Nutrient.NET SDK integrates OCR-based text extraction directly, eliminating the requirement for external tools or complex setups. Whether you’re building a document processing pipeline or adding extraction functionality to a web application, the SDK provides a reliable and efficient solution right out of the box.

## Preparing the project

Import the Nutrient namespace:

```csharp

using Nutrient;

```

## Loading and processing the image

Open the image file inside a [using statement](https://learn.microsoft.com/dotnet/csharp/language-reference/statements/using) and configure the vision API to use the OCR engine for text extraction:

```csharp

try
{
    using Document document = Document.Open("input.png");
    // Configure OCR engine for text extraction
    document.Settings.VisionSettings.Engine = VisionEngine.AdaptiveOcr;

```

The `Document.Open` method loads the image into memory and prepares it for OCR processing. Nutrient.NET SDK automatically detects the image format and applies appropriate preprocessing steps — such as deskewing or noise reduction — to improve recognition accuracy.

## Executing text recognition

Create a vision instance and extract the text content. The vision API analyzes the image structure, identifies text regions, and converts visual characters into structured digital text:

```csharp

    Vision vision = Vision.Set(document);
    string contentJson = vision.ExtractContent();

```

The `ExtractContent` method performs the actual text recognition, returning a JSON structure containing all recognized text with positioning information.

## Saving extracted results

Write the extracted content to a JSON file for use in downstream applications:

```csharp

    File.WriteAllText("output.json", contentJson);
}
catch (NutrientException e)
{
    Console.Error.WriteLine($"Error: {e.Message}");
    Environment.Exit(1);
}

```

This creates a JSON file containing all recognized text from the image. The structured output includes word-level bounding boxes and text content ready for:

- Search indexing

- Database storage

- Content management workflows

## Understanding the output

The `ExtractContent` method returns a JSON structure that provides comprehensive metadata for the processed document. This structure includes:

- **Text content** — The full string of extracted text from the document.

- **Bounding boxes** — The precise (x, y) coordinates and dimensions (width/height) of text regions on the page.

- **Word-level data** — Detailed information for individual words, including their specific coordinates and confidence scores.

In trial mode, extracted output can include hidden-content placeholders that mask parts of the text. For full validation of extraction quality, test with a valid production license.

## Error handling

The SDK throws a `NutrientException` if content extraction fails. This can happen if the image cannot be processed or if OCR resources aren’t available. Handle exceptions appropriately in production code to ensure a robust document processing pipeline.

## Conclusion

That’s all it takes to extract text from an image using OCR. The extracted content is ready for integration with search systems, accessibility tools, or automated data processing workflows. You can also download [this ready-to-use sample package](https://www.nutrient.io/downloads/samples/csharp/read-text-from-image.zip), fully configured to help you dive into Nutrient.NET SDK and explore text extraction capabilities.
---

## Related pages

- [Nutrient .NET SDK extraction guides](/guides/dotnet/csharp/extraction.md)
- [Applying OCR to a PDF page](/guides/dotnet/csharp/extraction/apply-ocr-to-pdf-page.md)
- [Applying OCR to a PDF document](/guides/dotnet/csharp/extraction/apply-ocr-to-pdf.md)
- [Classifying documents](/guides/dotnet/csharp/extraction/classify-document.md)
- [Generating image descriptions using Claude](/guides/dotnet/csharp/extraction/describe-image-with-claude.md)
- [Generating image descriptions using local AI](/guides/dotnet/csharp/extraction/describe-image-with-local-ai.md)
- [Generating image descriptions using OpenAI](/guides/dotnet/csharp/extraction/describe-image-with-openai.md)
- [Detecting document language](/guides/dotnet/csharp/extraction/detect-document-language.md)
- [Extracting data from images using ICR](/guides/dotnet/csharp/extraction/extract-data-from-image-icr.md)
- [Extracting data from images using OCR](/guides/dotnet/csharp/extraction/extract-data-from-image-ocr.md)
- [Extracting data from images using vision language models](/guides/dotnet/csharp/extraction/extract-data-from-image-vlm.md)
- [Extracting data from specific pages](/guides/dotnet/csharp/extraction/extract-data-from-specific-pages.md)
- [Extracting form fields from images](/guides/dotnet/csharp/extraction/extract-form-fields-from-image.md)
- [Extracting structured data from documents](/guides/dotnet/csharp/extraction/extract-structured-data.md)
- [Generating extraction schemas](/guides/dotnet/csharp/extraction/generate-extraction-schema.md)
- [Extracting JSON data from a PDF document](/guides/dotnet/csharp/extraction/json-data-extraction.md)
- [Labeling form fields with a vision language model](/guides/dotnet/csharp/extraction/label-form-fields-with-vlm.md)
- [Parsing a document into structured content](/guides/dotnet/csharp/extraction/parse-document.md)
- [Extracting text from PDF documents](/guides/dotnet/csharp/extraction/pdf-to-text.md)
- [Reading barcodes with vision extraction](/guides/dotnet/csharp/extraction/read-barcodes-with-vision.md)
- [Extracting text from multilingual images](/guides/dotnet/csharp/extraction/read-text-from-image-multi-language.md)
- [Searching document text](/guides/dotnet/csharp/extraction/search-document-text.md)
- [Speeding up first ICR operation by predownloading models](/guides/dotnet/csharp/extraction/speed-up-first-icr-by-downloading-requirements.md)

