Imagefont.textsize() Seems Wrong
I am trying to use PIL to precompute the size that a given line of text will take at a given font and size. PIL seemed to be more or less the only working solution. I tried to chec
Solution 1:
I managed to understand and found out how to get the desired effect.
Thanks to Mark Setchell for helping me on this other post.
What I got to understand was that pillow only cares about pixels, not about resolution. Thus I need to multiply the font size I am giving it by the resolution I intend to print at, then divide the result by that resolution, and finally convert from pts to millimeters.
The final formula is getfont('...', resolution * font_size).getsize('...')[0] / resolution * 0.352778
Post a Comment for "Imagefont.textsize() Seems Wrong"