Search code examples
c#.netsvgpng

C# .svg file to System.Drawing.Image


I need to convert the selected .svg file to System.Drawing.Image object, so I can resize it and save it as .png. Can anyone help me with this?

Here is what I have so far:

Svg.SvgDocument svgDocument = SVGParser.GetSvgDocument(mPath);
image = svgDocument.Draw();

But it gives me out of memory error.


Solution

  • So,

    SVGParser.MaximumSize = new System.Drawing.Size(4000, 4000);
    svgDocument = SVGParser.GetSvgDocument(mPath);
    var bitmap = svgDocument.Draw();
    image = bitmap;