Reading multilingual text from images
This guide demonstrates how to extract text from an image that contains multiple languages.
Use this workflow when you need to:
- Process mixed-language documents in one OCR pass
- Extract multilingual text for search, translation, or storage
- Reduce language-specific OCR branching in your pipeline
Project setup
Install:
- The core Nutrient Native SDK package
GdPicture.Resourcesfor 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 keyCreate OCR components
Create imaging and OCR instances:
using GdPictureImaging imaging = new GdPictureImaging();using GdPictureOCR ocr = new GdPictureOCR();Load the image and configure languages
Load the source image, set it on the OCR engine, and add the target languages:
int imageId = imaging.CreateGdPictureImageFromFile(@"input_ocr_multiple_languages.png");
ocr.SetImage(imageId);
ocr.AddLanguage(OCRLanguage.English);ocr.AddLanguage(OCRLanguage.French);Run OCR and save output
Execute OCR, read extracted text, and write it to a file:
string ocrResultId = ocr.RunOCR(OCRSpecialContext.None);
string result = ocr.GetOCRResultText(ocrResultId);
File.WriteAllText(@"output.txt", result);Conclusion
This workflow extracts multilingual text from an image and writes the OCR result to a text file.