You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
489 B
17 lines
489 B
from PIL import Image, ImageDraw, ImageFont
|
|
|
|
image_path = r"D:\KeCheng\BaiHu\Out\Images\User\16\b90bb411-9d81-4a46-9774-bc41f49fd324.png"
|
|
|
|
im = Image.open(image_path)
|
|
draw = ImageDraw.Draw(im)
|
|
width, height = im.size
|
|
text = "vx:绘智AI"
|
|
# 设置字体、字体大小等等
|
|
font = ImageFont.truetype(font='msyh.ttc', size=33) # 微软雅黑
|
|
# 添加水印
|
|
draw.text((width-200, height-100), text, font=font)
|
|
im.show()
|
|
im.close()
|
|
# 保存图片
|
|
# im.save('watermark2.jpg')
|