Skip to content

Release 2.0.1

Compare
Choose a tag to compare
@github-actions github-actions released this 13 Jan 02:07
· 5 commits to main since this release

Release Note

Dependency Updates

  • Replaced docsaidkit utilities with capybara:
    • For image resizing and file-handling functionalities.
    • Introduced at the start to emphasize its importance in enhancing functionality and performance.

Key Changes and Code Refactoring

Module Renaming and Restructuring

  • Renamed and Refactored Modules:

    • imgaug.py was renamed to custom_aug.py to better reflect its role in handling custom augmentation functionalities.
    • Utilities from base.py and utils.py were restructured into more specialized modules for improved code clarity and maintainability:
      • font_utils.py: Dedicated to font management, including loading, validating fonts, and introducing new functions for Unicode character validation and filtering.
      • text_image_renderer.py: Handles text-to-image rendering with extensive customization options, including multi-line text support and text stroke features.
    • Machine Readable Zone (MRZ) related functions from mrz.py and text2image.py were consolidated into mrz_generator.py for streamlined MRZ generation.
  • Introduced New Modules:

    • font_utils.py:
      • Implements font-related operations like loading, filtering, and validating characters against Unicode ranges.
      • Added multiple new functions to enhance font validation and improve robustness in character checks.
    • text_image_renderer.py:
      • Enables rendering of text into images with configurable direction, alignment, stroke, and spacing.
      • Introduced multi-line text rendering and enhanced text stroke options.
    • mrz_generator.py:
      • Focused exclusively on generating MRZ images with validation for text formatting and spacing.

Functional Enhancements

  • WordCanvas and RandomWordCanvas:

    • Split WordCanvas into two dedicated classes:
      • WordCanvas focuses on static, predictable text rendering.
      • RandomWordCanvas specializes in dynamic, randomized text and style generation.
    • Expanded randomization options for font, color, direction, and spacing.
    • Refined logic for image dimension adjustments and text alignment.
  • MRZGenerator:

    • Improved flexibility for generating MRZ text, supporting customizable lines, spacing, and randomization.
    • Enhanced character placement accuracy within MRZ images.
  • text2image:

    • Added features to control text stroke width and fill color.
    • Introduced support for multi-line text rendering.
    • Improved text alignment and spacing calculations for better visual rendering.
    • Returns metadata such as font path, actual font size, and text direction for enhanced traceability.

Testing Enhancements

  • Comprehensive Test Coverage:

    • Introduced new test files:
      • test_custom_aug.py:
        • Validates Shear augmentation under various probabilities and parameter combinations.
      • test_font_utils.py:
        • Ensures font-loading mechanisms and character filtering work as expected.
        • Tests new font validation functions thoroughly.
      • test_mrz_generator.py:
        • Tests MRZ generation for types TD1, TD2, and TD3 with text validation.
      • test_text_image_renderer.py:
        • Checks rendering accuracy, including alignment, direction, and text clamping.
        • Verifies new multi-line text and text stroke rendering.
      • test_word_canvas.py:
        • Validates WordCanvas and RandomWordCanvas functionalities, covering randomization and image alignment.
  • Advanced Testing Strategies:

    • Utilized pytest.mark.parametrize for efficient multi-case testing.
    • Simulated edge cases, including invalid font paths and incorrect text directions.
    • Integrated testing for combined functionalities (e.g., Shear and ExampleAug).
    • Enhanced error handling to strengthen validation for unsupported characters and corrupted fonts.

Deprecated and Removed Files

  • Removed the following obsolete or redundant files:
    • Test files: test_generator.py, test_imgaug.py, test_utils.py.
    • Modules: mrz.py, base.py, utils.py, text2image.py.

Full Changelog: [GitHub Compare Link](1.0.4...2.0.1)