Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
In this article, you will learn how to build a bare minimum Python console application for extracting text from an image with Aspose.OCR for Python via .NET.
ocr.py
.Open ocr.py in whatever code or plain text editor you prefer.
import aspose.ocr as ocr
api = AsposeOcr()
input = OcrInput(InputType.SINGLE_IMAGE)
input.add("source.png")
result = api.recognize(input)
print(result[0].recognition_text)
Full code:
import aspose.ocr as ocr
# Instantiate Aspose.OCR API
api = AsposeOcr()
# Add image to the recognition batch
input = OcrInput(InputType.SINGLE_IMAGE)
input.add("source.png")
# Recognize the image
result = api.recognize(input)
# Print recognition result
print(result[0].recognition_text)
input("Press Enter to continue...")
Run ocr.py. You will see extracted text in the console output:
Hello, World! I can read this text.
Press Enter to continue...
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.