Browse our Products

Aspose.OCR for Python via .NET 25.4.0 - Release Notes

What was changed

KeySummaryCategory
OCRNET‑995, OCRNET‑1000Added universal recognition of Arabic, Persian and English alphabets.New feature
OCRNET‑1002Automatic analysis of image content and detection of layout blocks.New feature
OCRNET‑1001Recognition speed improvements.Enhancement
OCRNET‑1006, OCRNET‑1012Add markdown output format with document layout.New feature
OCRNET‑1010, OCRNET‑1011Automatic language detection during recognition.New feature
OCRNET‑1009Docx output format improvements.Enhancement

Public API changes and backwards compatibility

This section lists all public API changes introduced in Aspose.OCR for Python via .NET 25.4.0 that may affect the code of existing applications.

Added public APIs:

The following public APIs have been introduced in this release:

aspose.ocr.ContentArea class

This class stores a layout block detected in an image.

PropertyTypeDescription
indexintThe sequential index of the content area, unique within the entire image.
rectangleaspose.ocr.RectangleThe bounding rectangle of the content area.

aspose.ocr.LayoutOutput class

This class stores a layout block detected in an image.

PropertyTypeDescription
sourcestringThe full path to the file or URL, if applicable. Empty for images provided as a stream, byte array, or Base64.
pageintPage number for multi-page images.
paragraphsArray of ContentAreaDetected paragraphs.
imagesArray of ContentAreaDetected illustrations.
headersArray of ContentAreaDetected headers.
tablesArray of ContentAreaDetected tables.
listsArray of ContentAreaDetected lists.
captionsArray of ContentAreaDetected captions.
equationsArray of ContentAreaDetected equations.

aspose.ocr.DetectDocumentLayout method

Analyzes images and identifies the different types of layout blocks within it. This method supports PNG, JPEG, BMP, TIFF, JFIF, and GIF images from files, streams, pixel arrays, and can bulk process folders and archives.

Detected layout blocks are returned as aspose.ocr.LayoutOutput object.

aspose.ocr.LanguageDetectionLevel enumeration

Defines the level of language detection for text recognition in an image:

LevelValueDescription
BY_PAGEaspose.ocr.LanguageDetectionLevel.BY_PAGEDetects a single language for the entire image.
BY_PARAGRAPHaspose.ocr.LanguageDetectionLevel.BY_PARAGRAPHDetects the language separately for each paragraph.
BY_WORDaspose.ocr.LanguageDetectionLevel.BY_WORDDetects the language separately for each word.

Updated public APIs:

The following public APIs have been updated in Aspose.OCR for .NET 25.4.0 release:

aspose.ocr.Language

Aspose.OCR for .NET can now extract mixed-language texts in Persian, Arabic and English alphabets.Use the following language identifier in recognition settings:

  • aspose.ocr.Language.PERSO_ARABIC
  • aspose.ocr.Language.ISLAMIC

aspose.ocr.Language

Aspose.OCR for .NET can now Automatically detects the language in the input document or image. Use the following language identifier in recognition settings:

  • aspose.ocr.Language.MULTILANGUAGE
  • aspose.ocr.Language.AUTO
  • aspose.ocr.Language.UNIVERSAL

aspose.ocr.SaveFormat

Aspose.OCR for .NET can now save the document as a Markdown (.md) file. If aspose.ocr.DetectAreasMode.MULTICOLUMN is used, images will also be extracted.

  • aspose.ocr.SaveFormat.MD

Removed public APIs:

No changes.

Examples

The code samples below illustrate the changes introduced in this release:

Detect languages on the image

# Instantiate Aspose.OCR API
api = AsposeOcr()
# Add image to the recognition batch
input = OcrInput(InputType.SINGLE_IMAGE)
input.add("source.png")
# Set language detection
set = RecognitionSettings()
set.language = Language.AUTO
set.language_detection_level = LanguageDetectionLevel.BY_WORD
# Detect languages and recognize image     
results = api.recognize(input, set)
for result in results:
    print(result.recognition_text)

Detect layout on the image

# Instantiate Aspose.OCR API
api = AsposeOcr()
# Add image to the recognition batch
input = OcrInput(InputType.SINGLE_IMAGE)
input.add("source.png")
# Detect layout
results = api.detect_document_layout(input)
# Print result
for result in results:
    print("paragraphs:" + str(len(result.paragraphs)))
    print("images:" + str(len(result.images)))
    print("tables:" + str(len(result.tables)))
    print("headers:" + str(len(result.headers)))
    print("lists:" + str(len(result.lists)))
    print("captions:" + str(len(result.captions)))
    print("equations:" + str(len(result.equations)))

# Recognize only headers
# Set rectangles for recognition
set = RecognitionSettings()
set.recognition_areas = [area.rectangle for area in result.headers] # use paragraphs or any other areas
# Recognize areas (rectangles)
results = api.recognize(input, set)
for result in results:
    print(result.recognition_text)