A fresh install of OpenSign will also install the latest Pillow (v10.2.0 as of 1/27/2024). Per this reference (https://github.com/tensorflow/models/issues/11040), Pillow removed the getsize function. This breaks OpenSign as opensign.py uses getsize. For example:
canvas.py:204: ... font.getsize(...)
Per the above page, the recommendation is to downgrade to Pillow 9.5 which restores the getsize.
# old way using getsize()
# text_width, text_height = font.getsize(text)
# using pillow 10+
left, top, right, bottom = font.getbbox(text)
text_width = right - left
text_height = bottom - top
The getsize function only appears once in canvas.py currently
A fresh install of OpenSign will also install the latest Pillow (v10.2.0 as of 1/27/2024). Per this reference (https://github.com/tensorflow/models/issues/11040), Pillow removed the getsize function. This breaks OpenSign as opensign.py uses getsize. For example: canvas.py:204: ... font.getsize(...) Per the above page, the recommendation is to downgrade to Pillow 9.5 which restores the getsize.
This StackOverflow post mentions how to do the equivalent using getbbox with slightly more code: (https://stackoverflow.com/questions/77341312/easy-way-to-replace-imagefont-getsizetext-to-imagefont-textbboxtext-in-pillo)
The getsize function only appears once in canvas.py currently