python-microscope / microscope

Python library for control of microscope devices, supporting hardware triggers and distribution of devices over the network for performance and flexibility.
https://www.python-microscope.org
GNU General Public License v3.0
69 stars 41 forks source link

Pillow 10 removes 'getsize' from 'FreeTypeFont' #290

Closed juliomateoslangerak closed 11 months ago

juliomateoslangerak commented 11 months ago

Getting images from the simulatedCamera returns this exception: 'ImageFont' object has no attribute 'getsize'

It seems that getsize was removed from the FreeTypeFont. (https://github.com/tensorflow/models/issues/11040)

The fix seems to be using getbbox. I tested replacing in the simulated camera getImage method and things work fine:

            size = tuple(d + 2 for d in self._font.getsize(text))

with

            size = tuple(d + 2 for d in self._font.getbbox(text)[-2:])

Con you guys validate this?

carandraug commented 11 months ago

This was reported in #282 and should have been fixed in 410b472. What you using development sources?

juliomateoslangerak commented 11 months ago

Oops! Sorry.

I'm using the development source but I did not pull since I did the installation a few weeks ago. Closing