✅ Can´t convert .svg to .png with C#

I don´t know a easy way to convert a .svg file to a .png file with a C# library that is open source? I want to learn it but I can´t find any right solution,
10 Replies
Angius
Angius3w ago
ImageMagick should be able to do that, so just find a wrapper for it or call it straight SkiaSharp can also load SVG, I believe
Daiko Games
Daiko GamesOP3w ago
I am just asking what commands do I have to use for ImageMagick to work. I couldn´t find anything that works.
Angius
Angius3w ago
magick convert -density 1200 -background none -resize x200 source.svg target.png? If not magick, then Inkscape can be used from CLI as well
Daiko Games
Daiko GamesOP3w ago
but that is a CMD command isn´t it?
Angius
Angius3w ago
ye
Daiko Games
Daiko GamesOP3w ago
I need a C# script, because I asked about a C# question?
ParaLogia
ParaLogia3w ago
you can run cmd commands with c#
Klarth
Klarth3w ago
There's no lightweight solution. You're basically either using ImageMagick (via Magick.NET) or using https://github.com/wieslawsoltes/Svg.Skia which requires you to ship Skia. SVG isn't an easy format. It's bloated web crap and that stuff typically has low demand from non-browser apps. See https://www.w3.org/TR/SVG11/expanded-toc.html to get an idea. Many SVGs use CSS styling, so any library implementer would need to write a CSS engine (or enough of one) to support that.
Daiko Games
Daiko GamesOP3w ago
Svg.Skia looks good, i will look after it later ok, looks good thanks
Want results from more Discord servers?
Add your server