How can I draw text with different stroke and fill colors on images with python?

后端 未结 6 593
忘了有多久
忘了有多久 2020-12-09 10:33

How can I draw text with different stroke and fill colors on images with python?

Here is some text with red stroke and gray fill.

6条回答
  •  天命终不由人
    2020-12-09 11:16

    They added a native solution within Pillow since 6.2.0: https://pillow.readthedocs.io/en/stable/reference/ImageDraw.html#PIL.ImageDraw.PIL.ImageDraw.ImageDraw.text

    You now specify the stroke_fill which is the color of the outline and stroke_width which is the thickness of the outline.

提交回复
热议问题