Skip to content

Commit 08acd3a

Browse files
committed
update
1 parent 1542a15 commit 08acd3a

3 files changed

Lines changed: 18 additions & 14 deletions

File tree

xyjxyf/0000/image_add_num.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

xyjxyf/show_me_the_code.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# coding = utf-8
2+
3+
from tools import imager
4+
from PIL import Image, ImageFont
5+
6+
# 第 0000 题:将你的 QQ 头像(或者微博头像)右上角加上红色的数字
7+
def add_num(image_path):
8+
im = imager.open_image(image_path)
9+
if im is not None:
10+
font = ImageFont.truetype('Arial.ttf', 20)
11+
w, h = im.size
12+
point = (w - 10, 0)
13+
imager.draw_text(im, "8", point, font)
14+
# imager.save(im, "./header_tmp.jpg")
15+
im.show()
16+
17+
if __name__ == "__main__":
18+
add_num("./header.jpg")

0 commit comments

Comments
 (0)