Read Screenshot
This code example demonstrates how to use the IronTesseract OCR engine to extract text from a screenshot image.
using IronOcr;
using System;
using System.Linq;
// Instantiate OCR engine
var ocr = new IronTesseract();
using var inputScreenshot = new OcrInput();
inputScreenshot.LoadImage("screenshotOCR.png");
// Perform OCR
OcrPhotoResult result = ocr.ReadScreenShot(inputScreenshot);
// Output screenshot information
Console.WriteLine(result.Text);
Console.WriteLine(result.TextRegions.First().Region.X);
Console.WriteLine(result.TextRegions.Last().Region.Width);
Console.WriteLine(result.Confidence);Imports IronOcr
Imports System
Imports System.Linq
' Instantiate OCR engine
Private ocr = New IronTesseract()
Private inputScreenshot = New OcrInput()
inputScreenshot.LoadImage("screenshotOCR.png")
' Perform OCR
Dim result As OcrPhotoResult = ocr.ReadScreenShot(inputScreenshot)
' Output screenshot information
Console.WriteLine(result.Text)
Console.WriteLine(result.TextRegions.First().Region.X)
Console.WriteLine(result.TextRegions.Last().Region.Width)
Console.WriteLine(result.Confidence)Install-Package IronOcr
This code example demonstrates how to use the IronTesseract OCR engine to extract text from a screenshot image.