# 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()