-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimage.py
More file actions
19 lines (16 loc) · 758 Bytes
/
image.py
File metadata and controls
19 lines (16 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from PIL import Image, ImageDraw, ImageFont
from api import doge
font = ImageFont.truetype('temp/NotoSansJP-Medium.otf', size=50)
bg = Image.open('temp/dollar-tp.png')
white = (255, 255, 255)
def coin(api):
if api[0] == 'DOGE':
doge = Image.open('temp/doge.png').resize((250, 250))
bg.paste(doge, (180, 50), doge)
draw = ImageDraw.Draw(bg)
draw.text((240, 300), f'{api[0]}', font=font, fill=white)
draw.text((710, 120), '%s' % (api[1]["price"]), font=font, fill=white)
draw.text((1000, 120), '%s' % (api[1]["price_base"]), font=font, fill=white)
draw.text((710, 270), '%s' % (api[2]["price"]), font=font, fill=white)
draw.text((1000, 270), '%s' % (api[2]["price_base"]), font=font, fill=white)
bg.save('image.jpg')