Convert PNG images to JPG in C#

You may often need to convert images from one format to another depending upon different scenarios. PNG to JPG is among the widely performed image conversions, which is commonly used to shrink image size. To automate this conversion from within the .NET applications, this article shows how to convert a PNG image to JPG in C#.

Convert PNG to JPG in C# - API Installation

To convert PNG images to JPG format, we will use Aspose.Imaging for .NET. It is a powerful image processing API that supports the manipulation of a wide range of image formats. Furthermore, its easy-to-use image converter lets you convert images from one format to another without degrading their quality. You can either download the API’s DLL or install it directly from NuGet.

PM> Install-Package Aspose.Imaging

TIP: Aspose.Slides .NET is another Aspose API capable of converting PNG to JPG images in C# and also handling the reverse JPG to PNG operation. Furthermore, this API allows you to perform conversion tasks involving other image formats such as PNG to SVG and the reverse SVG to PNG task.

How to Convert PNG to JPG in C#

The following are the steps to convert a PNG image to JPG format.

  • Load the PNG image from file.
  • Save PNG as JPG image to desired location.

That’s it.

Let’s now have a look at how to convert a PNG image to JPG format in C#.

Save a PNG as JPG in C#

Aspose.Imaging for .NET doesn’t involve any complex operations to perform PNG to JPG conversion. Simply, you need to load the PNG image and save it in JPG format. So let’s see how to convert a PNG image to JPG in C#.

The following code sample shows how to save a PNG image as JPG in C#.

PNG to JPG C# Converter - Get a Free License

You can get a free temporary license to convert PNG images to JPG format without evaluation limitations.

Conclusion

In this article, you have learned how to convert PNG images to JPG in C#. You can simply install the said API and integrate provided code sample to automate PNG to JPG conversion from within your .NET applications. In addition, you can explore more about the .NET image processing API using documentation. Also, you can post your queries on our forum.

See Also