Convert SVG to Image

In this article, I am going to show you how to convert SVG files to PNG, JPEG, TIFF, and other popular raster image formats using C# with Aspose’s .NET SVG API.

Aspose.SVG for .NET is a powerful API for processing SVG files using C# or VB.NET. It allows you to load, parse, and convert the SVG files to various other file formats. In this article, we’ll leverage the capabilities of the converter API of Aspose.SVG for .NET and learn how to perform the following SVG conversions:

C# SVG to Image Converter - Installation

Aspose.SVG for .NET is hosted on NuGet and can easily be installed using the NuGet Package Manager. Alternatively, you can download the API’s DLL from the Downloads section.

Convert SVG to PNG using C#

PNG is a popular image format because of its lossless compression. You can opt to convert SVG to PNG in case you want high-resolution images without losing the quality. The following are the steps to perform SVG to PNG conversion using Aspose.SVG for .NET.

The following code sample shows how to convert SVG to PNG using C#.

Convert SVG to JPEG Image using C#

Conversion of SVG to JPEG format is useful when you need to compress the image to reduce the file’s size. JPEG supports lossy compression which leads you to compromise the quality of the image. Here, the higher compression means a lower image quality. The following are the steps to export the SVG file to a JPEG image.

The following code sample converts an SVG file to the JPEG image in C#.

Convert SVG to BMP using C#

BMP format is in the business since long for digital representation of the images. BMP is known as a device-independent format which can be opened on multiple platforms such as Windows, Mac, etc. The following are the steps to perform SVG to BMP conversion using Aspose.SVG for .NET.

The following code sample shows how to save an SVG as BMP using C#.

Convert SVG to TIFF using C#

TIFF is another popular format for digital images that supports both lossy and lossless compression. It is more popular among graphic artists, industries as well as the photographer for producing the high resolution/quality images. The following are the steps for SVG to TIFF conversion.

The following code sample shows how to render an SVG file as a TIFF image using C#.

Convert SVG to GIF using C#

GIF is another raster image format that also supports high compression features. One of the popular use cases of GIF images is displaying the animations that are produced by combining multiple images into a single GIF file. The following are the steps to convert an SVG file to a GIF image.

The following code sample demonstrates SVG to GIF conversion using C#.

Conclusion

In this article, you have learned how to export SVG files to popular image formats using C#. The step by step guide and code samples demonstrate how to convert SVG to PNG, JPEG, BMP, TIFF, and GIF images. You can learn more about the C# SVG library using the documentation.

See Also

Tip: You may want to check out Aspose Text to GIF service that allows you to create beautiful animations just by typing.