import datetime
from PIL import Image, ImageDraw, ImageFont
# importing the image
img = Image.open("gfg.png")
draw = ImageDraw.Draw(img)
font = ImageFont.truetype("LXGWWenKaiScreen.ttf", 50)
left = 100
with open("text.txt","r") as f:
for line in f.readlines():
line = line.strip('\n')
draw.text((70, left), line, (255, 255, 255), font=font)
left = left + 70
draw.text((700, 888), "@何地似彼方", (255, 255, 255), font=font)
today = datetime.date.today()
formatted_time = today.strftime('%y%m%d')
# saving the image
img.save(formatted_time+'.jpg')
本文由 Ivan Dong 创作,采用 知识共享署名4.0 国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
最后编辑时间为: Apr 28, 2024 at 03:26 am