convert jpg images to png format in c#

JPG is one of the most popular and widely used image formats. However, JPG images lose quality each time they are saved. Therefore, you may need to convert them into a lossless format such as PNG. To perform this conversion programmatically from within the .NET applications, this article shows how to convert a JPG image to PNG in C#.

C# .NET API for JPG to PNG Conversion

Aspose.Imaging for .NET is a feature-rich image processing API to manipulate a multitude of image formats. Moreover, it provides a powerful converter that lets you convert images from one format to another with high fidelity. In this article, we will use this API to convert our JPG images to PNG format. 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 JPG to PNG images in C# and also handling the reverse PNG to JPG 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.

Info: If you have Aspose.Slides for .NET, you can also use it to convert JPG to PNG in C#.

Convert a JPG Image to PNG in C#

It is quite straightforward to convert a JPG image to PNG format using Aspose.Imaging for .NET. You only need to load the JPG file and save it as a PNG image. The following are the steps to convert a JPG image to PNG in C#.

The following code sample shows how to convert a JPG image to PNG format in .NET applications.

Get a Free API License

You can get a free temporary license to use Aspose.Imaging for .NET without evaluation limitations.

Conclusion

JPG to PNG conversion is often performed to convert images to a lossless format. In this article, you have learned how to convert JPG images to PNG format programmatically in C#. Thus, you can easily embed JPG to PNG conversion into 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