In this simple topic, you’ll learn how to convert SVG to PNG with NET REST API. We will develop an SVG to PNG converter with C# Low Code API by following the detailed and simple guidelines mentioned in the section below. This application can be amalgamated with any .NET application supported in Windows, Linux, or macOS environments and conversion can be performed for free.
Prerequisite
- Create an account and get API credentials to perform SVG to PNG conversion
- Download Aspose.Imaging Cloud SDK for .NET to convert SVG to PNG
- Setup C# .NET project with the above SDK to render SVG as PNG
Steps to Convert SVG to PNG with NET REST API
- Set the Client ID and Client Secret for the API to convert SVG to PNG
- Create an instance of ImagingAPI class with client credentials to perform SVG to PNG conversion
- Specify the source SVG and output PNG file names
- Read the source SVG file and upload it to cloud storage
- Create an instance of the ConvertImageRequest with input file stream and output PNG format
- Call the ConvertImage method to convert SVG to PNG with NET REST API
- Save the output PNG file on the local disk with the returned response stream
The specified steps transform the file type from SVG to PNG with C# Low Code API. We will start with the initialization of the configuration of the SDK by creating an instance of the ImagingAPI class. This will then be followed by accessing the source SVG file using a FileStream and creating the ConvertImageRequest class object that will further be used for performing the conversion to a PNG file using the ConvertImage() method.
Code for SVG to PNG Conversion in NET Low Code API
This example lets you convert SVG to PNG with C# Cloud API. You just need to provide an SVG file with the help of the Aspose.Imaging REST API SDK and download the output PNG file to save it locally. You can enhance the conversion process by setting various arguments during the ConvertImageRequest object that are set to null by default in this sample code.
In this example, we have learned to transform SVG to PNG with Cloud API. If you are looking to convert an SVG to a JPEG2000 image, refer to the article on how to Convert SVG to JPEG2000 with NET REST API.