Convert PNG to WEBP with NET REST API

In this simple topic, you’ll explore how to convert PNG to WEBP with NET REST API. We will develop a PNG to WEBP converter with C# Low Code API by adhering to the detailed steps mentioned below. The developed application code can be integrated with any .NET application supported in macOS, Windows, or Linux environments and conversion can be done for free.

Prerequisite

Steps to Convert PNG to WEBP with NET REST API

  1. Set the Client ID and Client Secret for the API to render PNG to WEBP
  2. Create an instance of the ImagingAPI class with client credentials to perform PNG to WEBP conversion
  3. Specify the source PNG and output WEBP file names
  4. Access and open the sample PNG file and upload it to cloud storage
  5. Instantiate the ConvertImageRequest with input PNG file stream and output WEBP format
  6. Call the ConvertImage method to convert PNG to WEBP with NET REST API
  7. Save the resultant WEBP file stream on the local disk

The steps for exporting the file type from PNG to WEBP with C# Low Code API are explained below. We will start with the initialization of the SDK by using an instance of the ImagingAPI class by providing the subscription credentials. We will then open the source PNG file using a FileStream from the disk and then by using a ConvertImageRequest class instance perform the conversion to a WEBP using the ConvertImage() method.

Code for PNG to WEBP Conversion in NET Low Code API

This crisp code example exhibits how to convert PNG to WEBP with C# Cloud API. After fulfilling the pre-requisite steps, you have to provide a path to access the source PNG image on the disk and by using the Aspose.Imaging REST API SDK performs the rendering to WEBP. The rendered WEBP image file stream is received as a response after the conversion is completed and you can then save it locally on the disk.

In this topic, we have focused on how to transform PNG to WEBP with Cloud API. If you are interested in learning about PNG to TIFF conversion, refer to the article on how to Convert PNG to TIFF with NET REST API.

 English