This quick tutorial explores how to resize SVG image using C# with the help of a few simple steps and an easily understandable code. You will learn to resize SVG using C# with the help of a couple of lines of code along with a detailed description and a list of to-do steps. It also directs to customize the output SVG file after changing its size.
Steps to Resize SVG Image using C#
- Configure the project environment to use Aspose.Imaging from the NuGet packages repository
- Load the sample SVG file to be resized using the Load method in the Image class
- Call the Resize() method in the Image class and provide the new size parameters
- Save the resultant SVG file back on the disk
These steps direct to change size of SVG image using C# by providing the environment configuration details and then to a list of simple steps to follow. You can load the SVG image similar to other types of images using the Image.Load() method. You can save the resultant SVG image to disk or stream and can customize it by providing an additional parameter SvgOptions if required.
Code to Resize an SVG Image using C#
To resize SVG file using C# you can use SvgOptions object that contains properties like VectorRasterizationOptions, TextAsShapes, Source, ResolutionSettings, Palette, MultiPageOptions, etc. to name a very few. You can also use SvgOptions.ReleaseManagedResources(), SvgOptions.ReleaseUnmanagedResources() to release respective resources.
In this tutorial we have learnt how to change the size of an SVG image using C#. If you want to learn the resizing of other types of images, refer to the article on how to resize image in C#.