-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'FreeTypeFont' object has no attribute 'getsize' with Pillow 10 #41
Comments
what version of python, and jupylet ? |
@functools.lru_cache(maxsize=2048)
def draw_chr(c, path, size):
font = load_font(path, size)
if hasattr(font, 'getsize'):
w, h = font.getsize(c)
else:
w, h = font.getbbox(c)[2:4]
im = PIL.Image.new('L', (w, h))
di = PIL.ImageDraw.Draw(im)
di.text((0, 0), c, fill='white', font=font)
return np.array(im) |
coming up - I pushed your fix to github along with other overdue changes (before a new release) - please pull and check it is fixed on your system - gave you the credit here https://github.com/nir/jupylet#whats-new-in-version-091. thanks! |
oh, but please install it into a clean virtual environment |
All OK. |
fix released with jupylet 0.9.1 thanks! |
I think, you can close this issue now. |
right in example
02-hello-jupylet
. This issue I found also in tensorflow, see this URL, where it was successfully resolved. I think, ipyleaflet can go this way, too (using old, deprecatedgetsize
if it is available, orgetbbox
if it is not.The text was updated successfully, but these errors were encountered: