Read Screenshot
This code example demonstrates how to use the IronTesseract OCR engine to extract text from a screenshot image.
An instance of the IronTesseract OCR engine is created. An OcrInput object is initialized, and the image ("screenshotOCR.png") containing the screenshot is loaded using the LoadImage method. The OCR engine processes the screenshot using the ReadScreenShot method, which returns an OcrPhotoResult object containing the recognized text and related regions. The extracted text from the screenshot is printed using result.Text. The X coordinate of the first recognized text region is printed using result.TextRegions.First().Region.X. The width of the last recognized text region is printed using result.TextRegions.Last().Region.Width. The OCR confidence score is printed using result.Confidence. This method allows for the extraction of text and region-specific details from screenshots, useful for capturing text in graphical content or interfaces.