|
|
@ -6,15 +6,15 @@ def WriteWenZi(image_path):
|
|
|
|
image = Image.open(image_path)
|
|
|
|
image = Image.open(image_path)
|
|
|
|
|
|
|
|
|
|
|
|
# 创建字体对象
|
|
|
|
# 创建字体对象
|
|
|
|
font = ImageFont.truetype('arial.ttf', size=24)
|
|
|
|
font = ImageFont.truetype('simkai.ttf', size=100)
|
|
|
|
|
|
|
|
|
|
|
|
# 创建绘图对象
|
|
|
|
# 创建绘图对象
|
|
|
|
draw = ImageDraw.Draw(image)
|
|
|
|
draw = ImageDraw.Draw(image)
|
|
|
|
|
|
|
|
|
|
|
|
# 设置文本内容和坐标
|
|
|
|
# 设置文本内容和坐标
|
|
|
|
text = 'Created by AI'
|
|
|
|
text = 'AI生成'
|
|
|
|
x = image.width - 200
|
|
|
|
x = image.width - 300
|
|
|
|
y = image.height - 50
|
|
|
|
y = image.height - 130
|
|
|
|
|
|
|
|
|
|
|
|
# 绘制文本
|
|
|
|
# 绘制文本
|
|
|
|
draw.text((x, y), text, font=font, fill='white')
|
|
|
|
draw.text((x, y), text, font=font, fill='white')
|
|
|
@ -24,4 +24,4 @@ def WriteWenZi(image_path):
|
|
|
|
image.close()
|
|
|
|
image.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WriteWenZi("d:\\9.png")
|
|
|
|
#WriteWenZi("d:\\9.png")
|
|
|
|