# pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pillow

from PIL import Image, ImageFont, ImageDraw

# 微软雅黑的字体
path_to_ttf = r'c:\windows\fonts\msyh.ttc'
font = ImageFont.truetype(path_to_ttf, size=100)

# 打开指定文件
img=Image.open(r"D:\少儿编程\Python\ShowImage\bin\Debug\学生\蔡昊.jpg")
# 写文字
draw = ImageDraw.Draw(img)
draw.text(xy=(100, 300), text='Hello,南墙已破!', font=font,fill=(255,0,0,255))
# 输出
img.show()

 

相关文章:

  • 2022-12-23
  • 2021-12-18
  • 2022-02-04
  • 2022-12-23
  • 2021-12-03
  • 2021-12-25
  • 2022-01-15
  • 2022-12-23
猜你喜欢
  • 2021-06-06
  • 2021-06-17
  • 2021-09-17
  • 2022-12-23
  • 2021-11-10
  • 2021-07-05
  • 2021-12-10
相关资源
相似解决方案