Merge SVG to JPEG in C#

SVG is one of the most used formats for website building and print graphics to achieve scalability. But sometimes, you need to merge SVG files and save them as one document in another file format. A JPEG is a type of image format that is saved using the method of lossy compression. The output image, as a result of compression, is a trade-off between storage size and image quality. With Aspose.SVG for .NET API, you can merge SVG to JPEG programmatically. Powerful C# API helps you to combine SVG files quickly and in high quality!


C# code example to merge SVG to JPEG

A high-speed C# library allows .NET developers to merge SVG files and convert the combined result into other popular formats such as PDF, XPS, JPEG, PNG, BMP, GIF, and TIFF quickly and efficiently. Documents merging can be done with a few lines of code:


Merge SVG to JPEG - C#

// Initialize SVG documents from files to merge 
using (var document1 = new SVGDocument("document1.svg"))
using (var document2 = new SVGDocument("document2.svg"))
using (var document3 = new SVGDocument("document3.svg"))
{
    // Create an instance of SvgRenderer
    using var renderer = new Aspose.Svg.Rendering.SvgRenderer();	
    // Create an instance of ImageDevice
    using var device = new Aspose.Svg.Rendering.Image.ImageDevice("result.jpg");
    // Merge SVG to JPEG
    renderer.Render(device, document1, document2, document3);                
}



Steps to Merge SVG to JPEG using C#

  1. Load SVG documents using one of the SVGDocument() constructors.
  2. Create a new instance of the SvgRenderer class.
  3. Use the ImageDevice() constructor to initialize a new instance of the ImageDevice class.
  4. Call the Render() method to merge several SVGs to JPEG image file.
  5. Multiple SVG files will be saved to the JPEG image on the specified path.

The Aspose.Svg.Rendering namespace implements easy access to Render() methods. You can quickly perform SVG merge and export the combining result to popular formats, such as PDF, XPS, JPEG, PNG, BMP, TIFF, and GIF. Please visit our Documentation to learn more about using Aspose.SVG API functions. In the documentation article How to Merge SVG Files , you can consider C# examples of how to merge SVG.


Online Image Merger

Aspose.SVG offers a free online Image Merger App that combines multiple images into a single file. You can choose a kind of Image Merger for different source files such as SVG, JPG, PNG, BMP, ICO, GIF, or TIFF, and save the result to one of the following output formats: JPG, PNG or SVG. Our application is multifunctional. You can create image collages, edit and manipulate images before merging. Image Merger allows you to freely add images, rotate, scale, add backgrounds, filters and move each image until you are happy with the end result of your design.


FAQ

1. How can I merge several SVG into JPEG?

You will sometimes need to merge two or more SVG images in your daily work. Aspose.SVG allows you to merge SVG into other formats in any way - online or programmatically. Online Image Combiner helps you combine images quickly and with high quality. C# API provides the Renderer class for rendering and merging SVG files programmatically.

2. In what formats can I save the result of SVG merge via C#?

You can save the SVG merge result in the most common formats such as JPG, PNG, BMP, GIF, TIFF, etc.

3. Why do I need to merge multiple SVG files?

There are many reasons why you want to merge several images into one. For example, you want to make a collage or create a new drawing based on several SVG images. You may need to merge SVG and save the result as JPEG for easy storage or mailing.

Get Started with .NET SVG API

If you are interested in developing scalable vector graphics and their application, install our flexible, high-speed Aspose.SVG for .NET API with a powerful set of interfaces for C# and other .NET programming languages.
Install from command line as nuget install Aspose.SVG or via Package Manager Console of Visual Studio with Install-Package Aspose.SVG. Alternatively, get the offline MSI installer or DLLs in a ZIP file from downloads. Aspose.SVG for .NET API is a standalone library and does not depend on any software for SVG document processing.
For more details about C# library installation and system requirements, please refer to Aspose.SVG Documentation.

Other Supported Mergers

You can merge SVG to many other file formats:

JPG to JPG (JPEG Image)
JPG to PNG (Portable Network Graphics)
JPG to BMP (Bitmap Image)
JPG to GIF (Graphical Interchange Format)
JPG to TIFF (Tagged Image Format)
PNG TO PNG (Portable Network Graphics)
PNG to JPG (JPEG Image)
PNG to BMP (Bitmap Image)
PNG to GIF (Graphical Interchange Format)
PNG to TIFF (Tagged Image Format)
GIF to JPG (JPEG Image)
GIF to PNG (Portable Network Graphics)
SVG TO PDF (Portable Document Format)
SVG TO XPS (XML Paper Specifications)
SVG TO BMP (Bitmap Image)
SVG TO IMAGE (Image formats)
SVG TO JPEG (JPEG Image)
SVG TO GIF (Graphical Interchange Format)
SVG to PNG (Portable Network Graphics)
SVG TO TIFF (Tagged Image Format)