This commit is contained in:
David Rodenkirchen 2024-08-30 00:26:39 +02:00
parent 4274632184
commit 2a4c11348a
4 changed files with 42 additions and 0 deletions

BIN
ezgg_logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
joystix.otf Normal file

Binary file not shown.

42
main.py Normal file
View File

@ -0,0 +1,42 @@
from pathlib import Path
import qrcode
from PIL import Image, ImageDraw, ImageFont
COLOR = (1, 135, 134)
FONT_LINK = ImageFont.truetype("joystix.otf", size=22)
FONT_ID = ImageFont.truetype("joystix.otf", size=28)
FONT_TEXT = ImageFont.truetype("joystix.otf", size=40)
ID_PREFIX = "EZ-ID:"
OUT_DIR = Path("./output")
num_label_start = int(input("Start ID: "))
num_label_end = int(input("End ID: "))
for num in range(num_label_start, num_label_end + 1):
num_as_string = f"{num:06}"
label_id = f"{ID_PREFIX}{num_as_string}"
print(f"Generating label \"{label_id}\"")
label = Image.new("RGB", (800, 350), (255, 255, 255))
logo = Image.open("ezgg_logo.png")
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L
)
qr.add_data(label_id)
qr.make(fit=True)
qr_img = qr.make_image(fill_color=COLOR, back_color="white")
label.paste(qr_img, (0, 10))
label.paste(logo, (290, 120))
draw = ImageDraw.Draw(label)
draw.text((15, 285), label_id, font=FONT_ID, fill=COLOR)
draw.text((320, 38), "Eigentum der", font=FONT_TEXT, fill=COLOR)
draw.text((570, 300), "ezgg-ev.de", font=FONT_LINK, fill=COLOR)
label.save(OUT_DIR / f"{num_as_string}.png")

0
output/.gitkeep Normal file
View File