Skip to content
Merged
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
Binary file added WangZhou/0000/consolab.ttf
Binary file not shown.
20 changes: 20 additions & 0 deletions WangZhou/0000/insert_num_angle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from PIL import Image, ImageDraw, ImageFont


def insert_angle_num(img):
"""
Insert a num on the right-upper angle,then save the new image.
:param img:string : filename of an Image object
"""
with Image.open(img) as im:
width, height = im.size
draw_image = ImageDraw.Draw(im)
color = '#ff0000'
num_font = ImageFont.truetype('consolab.ttf', 100)
draw_image.text((width - 80, 20), '7', font=num_font, fill=color)
im.save('new_message.jpg')


if __name__ == "__main__":
img = 'wz0000.jpg'
insert_angle_num(img)
Binary file added WangZhou/0000/new_message.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 WangZhou/0000/wz0000.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions WangZhou/0001/gen_act_key.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import uuid


def gen_act_key(n):
"""
生成 n 个激活码,保存在字典。
:param n: int
:return: dict
"""
act_code_store = {}

for i in range(n):
code0 = str(uuid.uuid1()).split('-')[0]
code1 = '-'.join(str(uuid.uuid3(uuid.NAMESPACE_DNS, f'{i}')).split('-')[1:])
act_code = code0 + '-' + code1
act_code_store[f'id-{i}'] = act_code
return act_code_store


if __name__ == "__main__":
activity_code = gen_act_key(200)