---
title: "Visas scanner: Scan and extract MRZ from visas | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/extraction/mrz/visas/"
md_url: "https://www.nutrient.io/guides/dotnet/extraction/mrz/visas.md"
last_updated: "2026-05-15T19:10:04.984Z"
description: "Learn how to scan and extract MRZ data from visa documents in C# using Nutrient .NET SDK. Automate data capture from travel documents programmatically."
---

# Scan and extract MRZ data from visas in C#

This guide demonstrates how to extract machine-readable zone (MRZ) data from visas using Nutrient.NET SDK. The MRZ, typically found at the bottom of personal identification documents, is readable via optical character recognition (OCR). Nutrient.NET SDK’s advanced OCR engine enables recognition of MRZ data in machine-readable travel documents (MRTD), including passports, visas, and ID cards.

## Extract MRZ information

To extract MRZ information from a visa, follow the steps below:

1. Create a `GdPictureImaging` object and a `GdPictureOCR` object.

2. Select the image by passing its path to the `CreateGdPictureImageFromFile` method of the `GdPictureImaging` object.

3. Set the image with the `SetImage` method of the `GdPictureOCR` object.

4. Run the OCR process by passing `OCRSpecialContext.MRZ` to the `RunOCR` method of the `GdPictureOCR` object.

5. Get the result of the OCR process as text with the `GetOCRResultText` method of the `GdPictureOCR` object.

6. Write the output to the console.

7. Release unnecessary resources.

The following example extracts MRZ information from a visa:

### C#

```csharp

using GdPictureImaging gdpictureImaging = new GdPictureImaging();
using GdPictureOCR gdpictureOCR = new GdPictureOCR();
// Select the image to process.
int imageId = gdpictureImaging.CreateGdPictureImageFromFile(@"C:\temp\source.png");
// Set the image.
gdpictureOCR.SetImage(imageId);
// Run the OCR process.
string resultId = gdpictureOCR.RunOCR(OCRSpecialContext.MRZ);
// Get the result of the OCR process as text.
string mrzData = gdpictureOCR.GetOCRResultText(resultId);
// Write the output to the console.
Console.WriteLine($"MRZ information: {mrzData}");
// Release unnecessary resources.
gdpictureImaging.ReleaseGdPictureImage(imageId);
gdpictureOCR.ReleaseOCRResults();

```

### VB.NET

```vb

Using gdpictureImaging As GdPictureImaging = New GdPictureImaging()
Using gdpictureOCR As GdPictureOCR = New GdPictureOCR()
    ' Select the image to process.
    Dim imageId As Integer = gdpictureImaging.CreateGdPictureImageFromFile("C:\temp\source.png")
    ' Set the image.
    gdpictureOCR.SetImage(imageId)
    ' Run the OCR process.
    Dim resultId As String = gdpictureOCR.RunOCR(OCRSpecialContext.MRZ)
    ' Get the result of the OCR process as text.
    Dim mrzData As String = gdpictureOCR.GetOCRResultText(resultId)
    ' Write the output to the console.
    Console.WriteLine($"MRZ information: {mrzData}")
    ' Release unnecessary resources.
    gdpictureImaging.ReleaseGdPictureImage(imageId)
    gdpictureOCR.ReleaseOCRResults()
End Using
End Using

```

#### Used methods and properties

- [`AddLanguage`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPictureOCR~AddLanguage.html)

- [`CreateGdPictureImageFromFile`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPictureImaging~CreateGdPictureImageFromFile.html)

- [`GetOCRResultText`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPictureOCR~GetOCRResultText.html)

- [`ReleaseGdPictureImage`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPictureImaging~ReleaseGdPictureImage.html)

- [`ReleaseOCRResults`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPictureOCR~ReleaseOCRResults.html)

- [`ResourceFolder`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPictureOCR~ResourceFolder.html)

- [`RunOCR`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPictureOCR~RunOCR\(\).html)

- [`SetImage`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPictureOCR~SetImage.html)

#### Related topics

- [Load a file](/guides/dotnet/load-a-file.md)

- [Save a file](/guides/dotnet/save-a-file.md)

---

## Related pages

- [Scan and extract MRZ data from drivers' licenses in C#](/guides/dotnet/extraction/mrz/drivers-licenses.md)
- [Scan and extract MRZ data from ID cards in C#](/guides/dotnet/extraction/mrz/id-cards.md)
- [Scan, read, and extract MRZ data from passports](/guides/dotnet/extraction/mrz/passports.md)
- [Parse and extract MRZ in C#](/guides/dotnet/extraction/mrz.md)

