enter image description hereThere are already a few questions, that sound quite similar to this one on stackoverflow, but their focuses are a little bit different from what I want to know.
I pasted a text on an image using ImageDraw from the Python Image Library. My question now is: Is there a way to find out the width and height of the text as a whole? For myself imagine the text to have kind of a rectangular frame. I want to get the measurements of this text-field. Can my text1 be treated like an image and can I get its size by typing in something like "width, height = text1.size"?
I have already tried to get the width, by using a ImageDraw.getwidth command, as proposed in other questions, but those solutions sadly didn't work for me.
What I want to achieve in particular is to be able to calculate, where the next text-field can be placed without overlaying the current text.
Thanks in advance for your support!
In the attached picture you can see the two ImageDraw-drawed texts, named "text" and "xyz". I want xyz to fit behind "test", even if "test" would include more letters. Therefor I need to know the width of "test".
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…