Skip to content

Commit 98e9496

Browse files
author
StevenWang
committed
wangzhou 0000 answer
1 parent 624a843 commit 98e9496

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

WangZhou/0000/consolab.ttf

375 KB
Binary file not shown.

WangZhou/0000/insert_num_angle.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from PIL import Image, ImageDraw, ImageFont
2+
3+
4+
def insert_angle_num(img):
5+
"""
6+
Insert a num on the right-upper angle,then save the new image.
7+
:param img:string : filename of an Image object
8+
"""
9+
with Image.open(img) as im:
10+
width, height = im.size
11+
draw_image = ImageDraw.Draw(im)
12+
color = '#ff0000'
13+
num_font = ImageFont.truetype('consolab.ttf', 100)
14+
draw_image.text((width - 80, 20), '7', font=num_font, fill=color)
15+
im.save('new_message.jpg')
16+
17+
18+
if __name__ == "__main__":
19+
img = 'wz0000.jpg'
20+
insert_angle_num(img)

WangZhou/0000/new_message.jpg

40.2 KB
Loading

WangZhou/0000/wz0000.jpg

41.7 KB
Loading

0 commit comments

Comments
 (0)