1、将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果。 类似于图中效果
实现代码:
# -*- coding: utf-8 -*- """ ------------------------------------------------- File Name: TEST Description : Author : Administrator date: 2018-05-09 ------------------------------------------------- Change Activity: 2018-05-09: ------------------------------------------------- """ __author__ = 'Administrator' from PIL import Image, ImageFont, ImageDraw, ImageColor def add_num(image, text): font = ImageFont.truetype("arial.ttf", 50) # 设置字体 fontcolor = ImageColor.colormap.get('yellow') # 设置字体颜色 draw = ImageDraw.Draw(image) # 将字加到图片上 width, height = image.size # 新生成的图片大小 draw.text((width-50, 30), text, font=font, fill=fontcolor) image.save("E:\\IMAGE3.jpg") # 图片保存 if __name__ == '__main__': image = Image.open('E:\\myblog1\S1.jpg') # 图片位置 text = '2' # 加的字 add_num(image, text)