Learn how to Extract JPG Text Using Python and Aspose.OCR
Last active
August 5, 2025 07:20
-
-
Save aspose-com-gists/19cae59f7efd199ecd360ba6a0bb8ddc to your computer and use it in GitHub Desktop.
Extract JPG Text Using Python and Aspose.OCR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aspose.ocr as ocr | |
# Instantiate Aspose.OCR API | |
api = ocr.AsposeOcr() | |
# Add image to the recognition batch | |
img = ocr.OcrInput(ocr.InputType.SINGLE_IMAGE) | |
img.add("sample-with-text.jpg") | |
# Recognize the image | |
result = api.recognize(img) | |
# Print recognition result | |
print(result[0].recognition_text) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aspose.ocr as ocr | |
# Instantiate Aspose.OCR API | |
api = ocr.AsposeOcr() | |
# Add image to the recognition batch | |
img = ocr.OcrInput(ocr.InputType.SINGLE_IMAGE) | |
img.add("sample.jpg") | |
# Recognize the image | |
result = api.recognize(img) | |
# Print recognition result | |
print(result[0].recognition_text) | |
# Save as DOCX | |
result[0].save("ImagetoDOCX.docx", ocr.SaveFormat.DOCX, ocr.PdfOptimizationMode.NONE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment