initial commit
This commit is contained in:
commit
126b124593
4 changed files with 20 additions and 0 deletions
5
README.md
Normal file
5
README.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
### Usage
|
||||
|
||||
```bash
|
||||
echo "Max Hackerberg\nLeibnizstr. 32\n39104 Magdeburg" | python address-label.py
|
||||
```
|
14
address-label.py
Normal file
14
address-label.py
Normal file
|
@ -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')
|
BIN
fonts/OpenSans-Regular.ttf
Normal file
BIN
fonts/OpenSans-Regular.ttf
Normal file
Binary file not shown.
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
Pillow==7.1.1
|
Loading…
Reference in a new issue