Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Created July 4, 2022 09:08
Show Gist options
  • Save aspose-com-gists/0f97a5118b8764e070403eaecd7bf1f6 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/0f97a5118b8764e070403eaecd7bf1f6 to your computer and use it in GitHub Desktop.
Convert Screenshot to Text with OCR in C# .NET
// Initialize an instance of AsposeOcr
Aspose.OCR.AsposeOcr api = new Aspose.OCR.AsposeOcr();
// Recognize screenshot image with OCR
string result = api.RecognizeImage("Test.png");
// Display the recognized text
Console.WriteLine(result);
// Get screenshot from URL for OCR
string uri = "https://qph.fs.quoracdn.net/main-qimg-0ff82d0dc3543dcd3b06028f5476c2e4";
// Initialize an instance of AsposeOcr
AsposeOcr api = new AsposeOcr();
// Recognize image
string result = api.RecognizeImageFromUri(uri);
// Print result
Console.WriteLine($"Text:\n {result}");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment