How to Convert PSD to PNG in C#

In this topic, we will focus on how to convert PSD to PNG in C# by covering all the details to set up the environment and use the example code. The application can be used to save PSD as PNG using C# using a few API calls and the application can be used in any of the .NET Configured environments inside Linux, macOS, or Windows.

Steps to Convert PSD to PNG in C#

  1. Set up the environment by installing Aspose.PSD for .NET from NuGet for exporting PSD to PNG
  2. Create a PsdImage class object to load the source PSD file from the disk
  3. Use the PngOptions class instance to set the output PNG options
  4. Convert the PSD to a PNG file using the Save method

In C# PSD to PNG converter application can be easily developed using the above mentioned steps, whereby the process will be initiated by loading the sample PSD file from the disk or memory stream using Image.Load() method. Then by using a PngOptions class object, the output PNG option required properties will be set, which is then followed by converting the PSD to a PNG file on the disk using the Save method.

Code to Export PSD to PNG in C#

The above example exhibits the process of converting a PSD to PNG using C# using few a API calls. The PsdLoadOptions is used to set the source PSD file options for loading and Image.Load() method is used to open the source PSD file from the disk. The PngOptions class is used to set the output PNG properties like ColorType, CompressionLevel, DefaultReplacementFont, ResolutionSettings, and MultiPageOptions to name a few. After setting the PNG properties, the desired PNG file will be saved either on the disk or inside the MemoryStream.

In this example, we have learned about the process of converting PSD to PNG using C# using a stepwise approach. If you are interested in learning about converting a PSD to PDF, refer to the article on how to convert PSD to PDF in C#.

 English