python PIL draw multiline text on image

后端 未结 6 1092
野的像风
野的像风 2020-12-04 10:14

I try to add text at the bottom of image and actually I\'ve done it, but in case of my text is longer then image width it is cut from both sides, to simplify I would like te

6条回答
  •  春和景丽
    2020-12-04 11:03

    The accepted answer wraps text without measuring the font (max 40 characters, no matter what the font size and box width is), so the results are only approximate and may easily overfill or underfill the box.

    Here is a simple library which solves the problem correctly: https://gist.github.com/turicas/1455973

提交回复
热议问题