forked from Decentrala/website
add imageposter mesh for dark
This commit is contained in:
parent
56149858bf
commit
7c134225ed
@ -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.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)
|
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')
|
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_bytes = io.BytesIO(mesh_svg)
|
mesh_svg_bytes = io.BytesIO(mesh_svg)
|
||||||
mesh_img = Image.open(mesh_svg_bytes)
|
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 = mesh_img.resize((W,H))
|
||||||
mesh_img.thumbnail((W,H), Image.Resampling.LANCZOS)
|
mesh_img.thumbnail((W,H), Image.Resampling.LANCZOS)
|
||||||
|
Loading…
Reference in New Issue
Block a user