Add screen for printing tool labels

This commit is contained in:
2022-10-17 16:34:24 -06:00
parent 984128f193
commit cd1d214384
4 changed files with 165 additions and 3 deletions

41
nametag.py Normal file
View File

@@ -0,0 +1,41 @@
from PIL import Image, ImageEnhance, ImageFont, ImageDraw
name = 'Tanner'
name_size = 305
quote = 'They made me wear this'
quote_size = 80
im = Image.open('label.png')
width, height = im.size
draw = ImageDraw.Draw(im)
w = 9999
while w > 1084:
name_size -= 5
font = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', name_size)
w, h = draw.textsize(name, font=font)
x, y = (width - w) / 2, (height - h) / 2
draw.text((x, y), name, font=font, fill='black')
w = 9999
while w > 1200:
quote_size -= 5
font = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', quote_size)
w, h = draw.textsize(quote, font=font)
x, y = (width - w) / 2, height - h - 30
draw.text((x, y), quote, font=font, fill='black')
im.save('tmp.png')
print('Dimentions:', height, width)