Merge SVG to PNG in C#

Combine SVG images and render the result as PNG with a cross-platform .NET API.

Merge SVG to PNG using Aspose.Slides

Aspose.Slides for .NET lets you create, convert, merge, and manipulate presentations, images, and other files. You can place multiple SVG images on a slide and render the result as a PNG image.

Merge SVG to PNG in C#

Using Aspose.Slides for .NET , you can add SVG images to a Presentation object and render the merged slide with GetImage.

C# code for merging SVG to PNG

using var presentation = new Presentation();
var slide = presentation.Slides[0];

var firstSvgImage = new SvgImage("image1.svg");
var firstPresentationImage = presentation.Images.AddImage(firstSvgImage);
slide.Shapes.AddPictureFrame(ShapeType.Rectangle, 0, 0, 360, 270, firstPresentationImage);

var secondSvgImage = new SvgImage("image2.svg");
var secondPresentationImage = presentation.Images.AddImage(secondSvgImage);
slide.Shapes.AddPictureFrame(ShapeType.Rectangle, 360, 0, 360, 270, secondPresentationImage);

using var image = slide.GetImage(1f, 1f);
image.Save("merged.png", ImageFormat.Png);

How to merge SVG to PNG in C#

  1. Install Aspose.Slides for .NET. See Installation .

  2. Add the library as a reference in your project.

  3. Create a Presentation object.

  4. Add the source SVG images to a slide as picture frames.

  5. Render the slide with GetImage and save the PNG image.

Merge other files

You can also combine files in other formats to get a single file