Skip to content
Merged

0000 #244

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions wssywh/0000/0000.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#coding:utf-8
#第 0000 题:将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果。
from PIL import Image, ImageDraw, ImageFont

__author__ = 'Hunter'

def picture_num(img,num):
im = ImageDraw.Draw(img)
print(img.size)
numFont = ImageFont.truetype("ahronbd.ttf",300)
im.text((260, -50), num, fill=(255, 0, 0),font=numFont)
img.save("wechat_100.jpg")
img.show()


if __name__ == '__main__':
img = Image.open("wechat.jpg")
picture_num(img,"100")
Binary file added wssywh/0000/ahronbd.ttf
Binary file not shown.
Binary file added wssywh/0000/wechat.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added wssywh/0000/wechat_100.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.