---
title: "Extracting data from images using ICR | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/csharp/extraction/extract-data-from-image-icr/"
md_url: "https://www.nutrient.io/guides/dotnet/csharp/extraction/extract-data-from-image-icr.md"
last_updated: "2026-10-08T00:00:00.000Z"
description: "Extract structured data from images using local ICR with Nutrient .NET SDK. Offline processing for air-gapped environments without API calls."
---

# Extracting data from images using ICR

Use ICR to extract structured document data from images with local models.

Common use cases include:

- Air-gapped document processing

- Privacy-sensitive workflows with local-only processing

- High-volume extraction with predictable runtime cost

- Pipelines that need layout and semantic structure

ICR returns more than plain text. It detects layout and semantic elements such as tables, key-value regions, headings, and equations.

[Download sample](https://www.nutrient.io/downloads/samples/csharp/extract-data-from-image-icr.zip)

## How Nutrient helps

Nutrient.NET SDK handles local model loading, layout analysis, and JSON output generation.

The SDK handles:

- Local model deployment and loading details

- Table detection and cell boundary extraction

- Semantic element classification and hierarchy parsing

- Bounding box and reading-order calculation

## Prerequisites

Before following this guide, ensure you have:

-.NET 8.0 or higher installed

- Nutrient.NET SDK referenced by your project

- An image file to process (PNG, JPEG, or other supported formats)

For initial SDK setup and configuration, refer to the [getting started](https://www.nutrient.io/sdk/dotnet/getting-started/csharp.md) guide.

## Complete implementation

This example extracts structured JSON from an image using the ICR engine:

```csharp

using Nutrient;

```

### Configuring ICR mode

Open the image with a [using statement](https://learn.microsoft.com/dotnet/csharp/language-reference/statements/using) and set the vision engine to ICR.

In this sample:

- Setting `Engine` to `VisionEngine.Icr` selects local ICR mode.

- ICR is the default engine, so this step is optional.

> ICR is the default engine, so this call is optional but shown here for illustration purposes.

```csharp

try
{
    using Document document = Document.Open("input_ocr_multiple_languages.png");
    // Configure ICR engine for local processing (this is the default)
    document.Settings.VisionSettings.Engine = VisionEngine.Icr;

```

### Creating a vision instance

Create a vision instance with `Vision.Set(document)` to bind extraction to the opened document:

```csharp

    var vision = Vision.Set(document);

```

### Performance tip: Preload Vision resources

The first ICR run may take longer because required Vision resources/models are downloaded and initialized on first use.
To avoid this startup delay during extraction, call `vision.Warmup()` once before `ExtractContent()`:

```csharp

    // Preload/download required Vision resources (first run can take time)
    vision.Warmup();

```

After warmup completes successfully, subsequent extractions are typically faster because resources are already cached locally.

### Extracting content

Call `ExtractContent()` to run local layout analysis. It returns structured JSON as a string, and processing runs locally when the engine is ICR:

```csharp

    string contentJson = vision.ExtractContent();

```

Write the JSON string to a file for downstream use.

Use the output for storage, indexing, or custom analysis:

```csharp

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

```

## Understanding the output

`ExtractContent()` returns structured JSON with layout and semantic information.

ICR output includes:

- **Document elements** — Paragraphs, headings, tables, figures, equations, and detected barcodes

- **Barcode data** — Decoded barcode values with symbology information for supported 1D and 2D barcode types

- **Bounding boxes** — Pixel coordinates for detected regions

- **Reading order** — Element order for content flow reconstruction

- **Element classification** — Semantic labels such as paragraph, table, heading, and barcode

- **Hierarchical structure** — Parent-child relationships across sections and blocks

Use this JSON for extraction pipelines, structured storage, and search indexing.

## Error handling

Vision API throws a `NutrientException` when extraction fails.

Common failure scenarios include:

- The image file can't be read because of path or permission issues.

- Image data is corrupted or truncated.

- ICR models are missing or inaccessible.

- Available memory is insufficient for model loading.

- Image format or encoding is unsupported.

In production code:

- Catch `NutrientException`.

- Return a clear error message.

- Log failure details for debugging.

## Conclusion

Use this workflow for ICR-based extraction:

1. Open the image document with a `using` statement for automatic resource cleanup.

2. Set `Engine` to `VisionEngine.Icr` in the vision settings for local AI processing.

3. ICR is the default engine, making this configuration optional but useful for explicit control.

4. Create a vision instance with `Vision.Set()` to bind content extraction operations to the document.

5. Optionally call `Warmup()` once to pre-download models and avoid first-run latency.

6. Call `ExtractContent()` to invoke local AI models for document layout analysis.

7. The ICR engine loads AI models, detects semantic elements (tables, equations, headings, and barcodes), and determines reading order.

8. The method returns a JSON-formatted string containing complete document structure with bounding boxes in pixel coordinates.

9. All processing occurs locally without external API calls, ensuring data privacy and offline capability.

10. Write the JSON content to a file for downstream pipelines, including data extraction, database storage, and search indexing.

11. Handle `NutrientException` failures for robust error recovery in production environments.

12. ICR mode is ideal for air-gapped environments, sensitive document processing, and high-volume workflows.

For related image extraction workflows, refer to the [.NET SDK guides](https://www.nutrient.io/guides/dotnet/csharp.md).

Download [this ready-to-use sample package](https://www.nutrient.io/downloads/samples/csharp/extract-data-from-image-icr.zip) to explore the Vision API capabilities with preconfigured ICR settings.
---

## 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 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)
- [Extracting text from images](/guides/dotnet/csharp/extraction/read-text-from-image.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)

