add A3 poster format
This commit is contained in:
parent
d4a8d92615
commit
e8b4495c58
@ -40,30 +40,30 @@ def load_events(csv_path:str, month:int) -> list[dict]:
|
||||
return events
|
||||
|
||||
def drawPoster(events, bg, fg, month:int):
|
||||
fontFacade = ImageFont.truetype('./site/font/Facade-Sud.woff', size=110)
|
||||
fontIosevka = ImageFont.truetype('./site/font/iosevka-regular.woff', size=60)
|
||||
fontIosevkaSmall = ImageFont.truetype('./site/font/iosevka-regular.woff', size=45)
|
||||
fontFacade = ImageFont.truetype('./site/font/Facade-Sud.woff', size=365)
|
||||
fontIosevka = ImageFont.truetype('./site/font/iosevka-regular.woff', size=200)
|
||||
fontIosevkaSmall = ImageFont.truetype('./site/font/iosevka-regular.woff', size=150)
|
||||
|
||||
W = 1200
|
||||
H = 1500
|
||||
W = 3508
|
||||
H = 4960
|
||||
img = Image.new('RGB', (W, H), bg)
|
||||
draw = ImageDraw.Draw(img)
|
||||
|
||||
header = "DECENTRALA"
|
||||
_, _, w, _ = draw.textbbox((0, 0), header, font=fontFacade)
|
||||
draw.text(((W-w)/2, 50), header, font=fontFacade, fill=fg)
|
||||
draw.text(((W-w)/2, 165), header, font=fontFacade, fill=fg)
|
||||
|
||||
subheader = f"Plan za {MONTHS_SR[month.month - 1]}"
|
||||
_, _, w, _ = draw.textbbox((0, 0), subheader, font=fontIosevka)
|
||||
draw.text(((W-w)/2, 170), subheader, font=fontIosevka, fill=fg)
|
||||
draw.text(((W-w)/2, 560), subheader, font=fontIosevka, fill=fg)
|
||||
|
||||
height = 300
|
||||
height = 990
|
||||
|
||||
draw.text((50, height), "Radionice pocinju u 19h u DC Krovu", font=fontIosevkaSmall, fill=fg)
|
||||
height += 60
|
||||
draw.text((165, height), "Radionice pocinju u 19h u DC Krovu", font=fontIosevkaSmall, fill=fg)
|
||||
height += 200
|
||||
|
||||
draw.text((50, height), "Svi dogadjaji su uvek besplatni", font=fontIosevkaSmall, fill=fg)
|
||||
height += 90
|
||||
draw.text((165, height), "Svi dogadjaji su uvek besplatni", font=fontIosevkaSmall, fill=fg)
|
||||
height += 300
|
||||
|
||||
# Write list of events to sperate text file as well
|
||||
textfile=open("poster.txt","w")
|
||||
@ -81,8 +81,8 @@ def drawPoster(events, bg, fg, month:int):
|
||||
title = event["title"]
|
||||
pad = " " if event["date"].day < 10 else ""
|
||||
eventText = f"{date} {day}. {pad} {title}"
|
||||
draw.text((50, height), eventText, font=fontIosevkaSmall, fill=fg)
|
||||
height += 70
|
||||
draw.text((165, height), eventText, font=fontIosevkaSmall, fill=fg)
|
||||
height += 200
|
||||
|
||||
# Add event to textfile
|
||||
textfile.write(eventText + "\n")
|
||||
@ -90,20 +90,20 @@ def drawPoster(events, bg, fg, month:int):
|
||||
textfile.close()
|
||||
|
||||
def drawCircle(x, y):
|
||||
r = 10
|
||||
r = 50
|
||||
draw.ellipse((x - r, y - r, x + r, y+r), fill=fg, outline=(0, 0, 0), width=0)
|
||||
|
||||
LCX = 1050 # logo center x
|
||||
LCY = 1300 # logo center y
|
||||
d = 50 # delta
|
||||
LCX = 3100 # logo center x
|
||||
LCY = 4350 # logo center y
|
||||
d = 190 # delta
|
||||
drawCircle(LCX - d, LCY)
|
||||
drawCircle(LCX, LCY)
|
||||
drawCircle(LCX, LCY - d)
|
||||
drawCircle(LCX, LCY + d)
|
||||
drawCircle(LCX + d, LCY)
|
||||
|
||||
draw.line([(LCX - d, LCY), (LCX + d, LCY)], fill=fg, width=5, joint=None)
|
||||
draw.line([(LCX, LCY), (LCX, LCY + d), (LCX + d, LCY), (LCX, LCY - d)], fill=fg, width=5, joint=None)
|
||||
draw.line([(LCX - d, LCY), (LCX + d, LCY)], fill=fg, width=20, joint=None)
|
||||
draw.line([(LCX, LCY), (LCX, LCY + d), (LCX + d, LCY), (LCX, LCY - d)], fill=fg, width=20, joint=None)
|
||||
draw.text((LCX - 1.7*d, LCY + 1.5*d), "dmz.rs", font=fontIosevka, fill=fg)
|
||||
|
||||
return img
|
||||
|
Loading…
Reference in New Issue
Block a user