Use a clipPath instead of mask for image, fixes issue with PNGs

This commit is contained in:
Artemis Tosini 2023-09-24 05:10:44 +00:00
parent e806571ae2
commit 63c18f09fe
Signed by: artemist
GPG key ID: EE5227935FE3FF18
2 changed files with 5 additions and 6 deletions

View file

@ -58,7 +58,6 @@
width: width,
height: height,
breakable: false,
fill: luma(240),
address_content(width, height, card)
)
}

View file

@ -43,11 +43,11 @@ def get_avatar(url: str) -> str:
return ""
svg_text = f"""<svg viewBox="0 0 480 480" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<mask id="circle" width="480" height="480">
<circle cx="240" cy="240" r="240" fill="white"></circle>
</mask>
<image width="480" height="480" mask="url(#circle)"
xlink:href="data:;base64,{base64.b64encode(avatar_raster).decode("utf-8")}"></image>
<clipPath id="circle">
<circle cx="240" cy="240" r="240" />
</clipPath>
<image width="480" height="480" clip-path="url(#circle)"
xlink:href="data:;base64,{base64.b64encode(avatar_raster).decode("utf-8")}" />
</svg>"""
with open(f"cache/{name}.svg", "w") as svgfile: