Skip to content
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

textsize deprecated in Pillow 10, causes error "'ImageDraw' object has no attribute 'textsize'" in dotplot.py #72

Closed
erikwolfsohn opened this issue Mar 19, 2024 · 1 comment

Comments

@erikwolfsohn
Copy link

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 by textlength. 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.

@erikwolfsohn 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
@rrwick
Copy link
Owner

rrwick commented Apr 2, 2024

Thanks for pointing this one out - the fix is in the latest release of Trycycler (v0.5.5) which is now on Bioconda.

Ryan

@rrwick rrwick closed this as completed Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants