Belval / TextRecognitionDataGenerator

A synthetic data generator for text recognition
MIT License
3.15k stars 943 forks source link

Fixes getsize AttributeError in newer versions of Pillow library. #328

Closed prathameshza closed 5 months ago

prathameshza commented 6 months ago

Description: This pull request addresses the issue caused by the AttributeError in newer versions of the Pillow library. The error stems from the 'FreeTypeFont' object lacking the 'getsize' attribute. The root cause appears to be a change in Pillow's API.

Solution: To resolve this issue, I replaced the usage of getsize with getbbox in the affected code. This adjustment ensures compatibility with both older and newer versions of the Pillow library.

Changes Made:

Testing: Verified the fix by testing the code against both older and newer versions of the Pillow library. The modified code functions as intended without any AttributeError.

Notes: It's observed that downgrading Pillow to version 9.5.0 also resolves the issue. However, the proposed solution ensures compatibility with the latest versions of Pillow and is a more forward-looking approach.

Additional Context: Refer this issue: (Pillow 10) #11040