commit 126b124593657819f9078ec792c045e6a00855f4 Author: David Kilias Date: Sun Apr 5 22:46:22 2020 +0200 initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..566990e --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +### Usage + +```bash +echo "Max Hackerberg\nLeibnizstr. 32\n39104 Magdeburg" | python address-label.py +``` \ No newline at end of file diff --git a/address-label.py b/address-label.py new file mode 100644 index 0000000..1db7652 --- /dev/null +++ b/address-label.py @@ -0,0 +1,14 @@ +from PIL import Image, ImageDraw, ImageFont +import sys + +address = sys.stdin.readline() + +img = Image.new('RGB', (696, 160), color = (255, 255, 255)) + +fnt0 = ImageFont.truetype('fonts/OpenSans-Regular.ttf', 14) +fnt = ImageFont.truetype('fonts/OpenSans-Regular.ttf', 32) +d = ImageDraw.Draw(img) +d.text((20,10), "Netz39 e.V., Leibnizstr. 32, 39104 Magdeburg", font=fnt0, fill=(0,0,0)) +d.text((20,25), address.strip('\"'), font=fnt, fill=(0, 0, 0)) + +img.save('pil_text_font.png') \ No newline at end of file diff --git a/fonts/OpenSans-Regular.ttf b/fonts/OpenSans-Regular.ttf new file mode 100644 index 0000000..db43334 Binary files /dev/null and b/fonts/OpenSans-Regular.ttf differ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..747d513 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +Pillow==7.1.1