Skip to content

Commit

Permalink
add base code
Browse files Browse the repository at this point in the history
  • Loading branch information
cazci committed Mar 7, 2023
0 parents commit 2c82116
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
venv/
1 change: 1 addition & 0 deletions Invitations.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name,gender,group
Binary file added Lato/Lato-Italic.ttf
Binary file not shown.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Bulk Invitation
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pillow==9.4.0
31 changes: 31 additions & 0 deletions transpiler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import csv
from PIL import Image, ImageFont, ImageDraw

with open('invitations.csv', mode ='r') as file:
names = csv.reader(file)
font = ImageFont.truetype('Lato/Lato-Italic.ttf', 34)

for name in names:
invitation = Image.open("invitation.png")
editable = ImageDraw.Draw(invitation)

cutoff
cutoffOffset = (0, 0)

if (name[1] == "m"):
cutoff = "__________________"
cutoffOffset = (0, 0)
elif (name[1] == "f"):
cutoff = "______________"
cutoffOffset = (0, 0)
elif (name[1] == "b"):
cutoff = "_______ ________"
cutoffOffset = (0, 0)

editable.text((0, 0), name[0], (0, 0, 0), font=font)

if (cutoff != "_"):
editable.text(cutoffOffset, cutoff, (0, 0, 0), font=font)

invitation.save("exports/" + name[2] + "/"+ name[0] + ".png")

0 comments on commit 2c82116

Please sign in to comment.