Skip to content

LeetCode Stats Cards SVG to PNG conversion #208

@Kevin-Roman

Description

@Kevin-Roman

Problem Description

When the /stats feature was developed (now in /utils/stats.stats_card) I couldn't figure out any way to directly convert the SVGs from https://leetcard.jacoblin.cool/ to PNGs as they always ended up looking entirely off, likely due to the SVG's usage of animation.

The solution devised was to use HTML2Image to run a browser in headless mode and take a screenshot of the rendered SVG. However, this is clearly not ideal, therefore it could be potentially further looked into the possibility of converting the SVG to PNG.

Potential Approaches

  • Converting the SVG's XML to an XML structure/format/styling that leads to correct PNG conversion.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions