from PIL import Image, ImageDraw, ImageFont
def add_num(image):
draw = ImageDraw.Draw(image)
font = ImageFont.truetype('C:/windows/fonts/arial.ttf', size=50)
fillcolor = "#f0000f"
width, height = image.size
draw.text((width-60, 0), '50', font= font, fill= fillcolor)
image.save('result-1.jpg', 'jpeg')
return 0
if __name__ == '__main__':
image = Image.open('image.jpg')
add_num(image)
show me the code 第 0000 题: 将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果
最新推荐文章于 2022-06-10 17:53:33 发布