小编Lor*_*nzo的帖子

水印:将旋转文本粘贴到空图像上

我想旋转并通过旋转的图像,就像所附的图像一样。我的结果不居中,文本超出图像。图像尺寸为 794x1096 你可以帮我吗?

这是我的代码:

x = input('Insert Name Here ')
y = input('Insert full name')
img = Image.open("Path/watermark_example.png")
draw = ImageDraw.Draw(img)
font = ImageFont.truetype('calibri.ttf', 55)
draw.text((30, 300),x,(128, 128, 128, 255), font=font)
draw.text((500, 500),x,(128, 128, 128, 255),font=font)
img1 = img.rotate(15, expand = True, fillcolor = 'white')
img.putalpha(128)
img.paste(img1)
img.show()
img.save(f'Path/watermark_example{y}.png')
Run Code Online (Sandbox Code Playgroud)

例子

python python-imaging-library

1
推荐指数
1
解决办法
1371
查看次数

标签 统计

python ×1

python-imaging-library ×1