From 7c134225ed7018b050de8e4383256f542d3a06fa Mon Sep 17 00:00:00 2001 From: fram3d Date: Sat, 1 Jun 2024 17:18:36 +0200 Subject: [PATCH] add imageposter mesh for dark --- image_poster.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/image_poster.py b/image_poster.py index 9be0ea8d..883261b4 100755 --- a/image_poster.py +++ b/image_poster.py @@ -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)