【发布时间】:2018-09-10 03:46:00
【问题描述】:
我想在图片上设置水印文字...所以我尝试使用 PIL 库
def watermark_text(input_image,
output_image,
text, pos):
photo = Image.open(input_image)
drawing = ImageDraw.Draw(photo)
color = (255, 180, 80)
font = ImageFont.truetype("arial.ttf", 40)
drawing.text(pos, text, fill=color, font=font)
photo.show()
photo.save(output_image)
if __name__ == '__main__':
img = 'cat.jpg'
watermark_text(img, 'cats.jpg',
text='Sample Location Text',
pos=(180, 200))
但我想要这种类型的交叉透明颜色的文本:
【问题讨论】:
-
参考这个问题。您可以在stackoverflow.com/questions/245447/… 中尝试答案
标签: python python-imaging-library