PSD images can contain a lot of visual information in the form of layers. Sometimes the file size can grow up to hundreds of megabytes so you may need to compress a PSD image to reduce the file size. In accordance with that, the article discusses how to compress a PSD file programmatically in C#.
C# API to Compress a PSD Photoshop File – Installation
We learned about creating a PSD image programmatically with Aspose.PSD for .NET API. You can also compress a PSD image in C#. Simply configure the API by downloading its DLL file from the New Releases section or using the NuGet installation command:
PM> Install-Package Aspose.PSD
Compress a PSD Image Programmatically in C#
A PSD file can contain several layers for displaying text, graphics, vectors, etc. You can compress a PSD image in C# by following the steps below:
- Load an input PSD image using the PsdImage class.
- Initialize PsdOptions class object.
- Specify the compression method using the CompressionMethod enumeration.
- Finally, save the compressed output PSD file with reduced file size.
The following code snippet demonstrates how to compress a PSD image programmatically in C#:
Explore API Features
You may explore the documentation section to learn about many other features included in the API.
Get Free Evaluation License
You can evaluate the API in full capacity without any evaluation limitations by requesting a free temporary license.
Conclusion
In this article, you have inspected how to compress a PSD image programmatically using C#. You can reduce the file size by a good ratio without losing the quality of the image. Moreover, if you need to discuss any of your requirements or concerns, please feel free to write to us at the forum.