Skip to content

Commit d75aef2

Browse files
committed
0000 commit
1 parent 42e2842 commit d75aef2

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Jimmy66/0000/0000.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from PIL import Image,ImageDraw,ImageFont
2+
3+
def addNum(filePath):
4+
img = Image.open(filePath)
5+
size = img.size
6+
fontSize = size[1] / 4
7+
draw = ImageDraw.Draw(img)
8+
9+
ttFont = ImageFont.truetype("/Library/Fonts/arial.ttf", fontSize)
10+
draw.text((size[0]-fontSize, 0), "6",(256,0,0), font=ttFont)
11+
del draw
12+
img.save('./result.jpg')
13+
img.show()
14+
15+
16+
if __name__ == '__main__':
17+
addNum("image.jpg")

Jimmy66/0000/image.jpg

45.7 KB
Loading

0 commit comments

Comments
 (0)