You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! On Trycycler 0.5.4 installed via conda, dotplot.py fails with the error 'ImageDraw' object has no attribute 'textsize' It looks like textsize was deprecated in Pillow 10 and superseded bytextlength. Installing into a fresh environment via the Trycycler conda recipe provided Pillow 10.2.0 by default.
I think there shouldn't be any issues downgrading Pillow, but I just replaced each instance of text_width, text_height = draw.textsize(label, font=font) with
text_width = draw.textlength(label, font=font) text_height = draw.textlength(label, font=font)
and it seemed to work fine.
It also seems like the new textlength method returns floats by default while 'textsize' returned ints which will cause another crash. I just changed the type in the return statement like so return font, int(text_width), int(text_height), font_size which doesn't appear to be causing issues. I don't know if that new method could potentially return fractional values that would produce mangled results though.
Also just want to say I really appreciate this tool and really appreciate the incredibly detailed guidance and documentation you've written to accompany it - I'm beginning to work with long read data regularly and this has been an unbelievable resource.
The text was updated successfully, but these errors were encountered:
erikwolfsohn
changed the title
'ImageDraw' object has no attribute 'textsize' -- textsize deprecated in Pillow
textsize deprecated in Pillow 10, causes error "'ImageDraw' object has no attribute 'textsize'" in dotplot.py
Mar 19, 2024
Hi! On Trycycler 0.5.4 installed via conda, dotplot.py fails with the error
'ImageDraw' object has no attribute 'textsize'
It looks liketextsize
was deprecated in Pillow 10 and superseded bytextlength
. Installing into a fresh environment via the Trycycler conda recipe provided Pillow 10.2.0 by default.I think there shouldn't be any issues downgrading Pillow, but I just replaced each instance of
text_width, text_height = draw.textsize(label, font=font)
withtext_width = draw.textlength(label, font=font)
text_height = draw.textlength(label, font=font)
and it seemed to work fine.
It also seems like the new
textlength
method returns floats by default while 'textsize' returned ints which will cause another crash. I just changed the type in the return statement like soreturn font, int(text_width), int(text_height), font_size
which doesn't appear to be causing issues. I don't know if that new method could potentially return fractional values that would produce mangled results though.Also just want to say I really appreciate this tool and really appreciate the incredibly detailed guidance and documentation you've written to accompany it - I'm beginning to work with long read data regularly and this has been an unbelievable resource.
The text was updated successfully, but these errors were encountered: