2
0
Fork 0

add imageposter mesh for dark

This commit is contained in:
fram3d 2024-06-01 17:18:36 +02:00
parent 56149858bf
commit 7c134225ed
Signed by: fram3d
GPG Key ID: 938920E709EEA32A
1 changed files with 7 additions and 4 deletions

View File

@ -107,12 +107,15 @@ def drawPoster(events, bg, fg, month:int):
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)
if bg == (255,255,255):
mesh_svg = svg2png(url='site/img/mesh-light.svg')
if bg == (0,0,0):
mesh_svg = svg2png(url='site/img/mesh-dark.svg')
mesh_svg = svg2png(url='site/img/mesh-light.svg')
mesh_svg_bytes = io.BytesIO(mesh_svg)
mesh_img = Image.open(mesh_svg_bytes)
if bg == (0,0,0):
pixdata = mesh_img.load()
for y in range(mesh_img.size[1]):
for x in range(mesh_img.size[0]):
if pixdata[x,y] != (0,0,0,0):
pixdata[x, y] = (0, 255, 0, 255)
mesh_img = mesh_img.resize((W,H))
mesh_img.thumbnail((W,H), Image.Resampling.LANCZOS)