How to Convert SVG to JPG in C#

This precise tutorial focuses on how to convert SVG to JPG in C#. It includes environment setup details along with the algorithm and a code snippet to export SVG document to JPG in C#. Furthermore, you can create different variations of JPG images by changing the preferences for the output image.

Steps to Convert SVG File to JPG in C#

  1. Setup the environment by installing Aspose.HTML for .NET library to convert SVG images
  2. Load the input SVG image with the SVGDocument class
  3. Set different image properties using the ImageSaveOptions class
  4. Export SVG to JPG image using the ConvertSVG method

These steps summarize the details to convert SVG file to JPG in C# where the input SVG file is loaded in the first step. In the next step, different properties of the JPG image are specified. Finally, the JPG image is rendered with a single method call which concludes the conversion process.

Code Snippet to Convert SVG File to JPG in C#

This code snippet demonstrates how to convert a file from SVG to JPG in C#. Besides, you can improvise this code to meet your requirements. For example, vertical and horizontal resolution, page settings like size, margin, and various other properties can be customized as per your needs.

This tutorial has explained how to render SVG to JPG in C#. However, if you want to learn HTML to JPG image conversion, please refer to the article on how to convert HTML to JPG in C#.

 English