✅ 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
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
I am just asking what commands do I have to use for ImageMagick to work. I couldn´t find anything that works.
magick convert -density 1200 -background none -resize x200 source.svg target.png
?
If not magick, then Inkscape can be used from CLI as wellbut that is a CMD command isn´t it?
ye
I need a C# script, because I asked about a C# question?
you can run cmd commands with c#
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.
Svg.Skia looks good, i will look after it later
ok, looks good thanks