This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/dotnet/ocr/usage/read-text-from-image.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Reading text from images | Nutrient .NET SDK

This guide demonstrates how to extract text from an image using OCR.

Use this workflow when you need to:

  • Convert image-based text into editable text output
  • Index scanned content for search
  • Feed OCR output into validation or automation pipelines

Project setup

Install:

  • The core Nutrient Native SDK package
  • GdPicture.Resources for OCR language resources

Prepare the project

Register the SDK license before running OCR operations. For setup details, refer to the getting started with .NET SDK guide.

using GdPicture14;
LicenseManager licence = new LicenseManager();
licence.RegisterKEY(""); // Set your license key

Load and prepare the image

Create imaging and OCR instances, load the source image, and set it for OCR:

using GdPictureImaging imaging = new GdPictureImaging();
using GdPictureOCR ocr = new GdPictureOCR();
// Load the image containing text to be extracted
int imageId = imaging.CreateGdPictureImageFromFile(@"input.png");
// Apply the image to the OCR engine for processing
ocr.SetImage(imageId);

Run text recognition

Execute OCR and read the recognized text result:

// Run OCR analysis to identify and extract text
string ocrResultId = ocr.RunOCR(OCRSpecialContext.None);
// Retrieve the recognized text content
string result = ocr.GetOCRResultText(ocrResultId);

Save extracted text

Write OCR output to a text file:

// Save the extracted text to a file
File.WriteAllText(@"output.txt", result);

Additional OCR options

Extend this workflow with:

  • Language-specific OCR configuration for targeted recognition
  • Confidence-based review logic
  • Region-based OCR for specific image areas
  • Layout-aware post-processing for structured documents

Conclusion

This workflow extracts text from an image and saves it as plain text for downstream processing.