parent
51133146b9
commit
034e638cff
After Width: | Height: | Size: 377 KiB |
@ -0,0 +1,16 @@
|
|||||||
|
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 = "绘鸭"
|
||||||
|
# 设置字体、字体大小等等
|
||||||
|
font = ImageFont.truetype(font='msyh.ttc', size=33) # 微软雅黑
|
||||||
|
# 添加水印
|
||||||
|
draw.text((width-100, height-100), text, font=font)
|
||||||
|
im.show()
|
||||||
|
im.close()
|
||||||
|
# 保存图片
|
||||||
|
# im.save('watermark2.jpg')
|
Loading…
Reference in new issue