PSD files are used to create images using different layers containing shapes, text, effects, etc. You may need to create a PSD image programmatically in your applications. In accordance with such image processing scenarios, this article covers how to create a PSD image programmatically in C#.
C# API to Create a PSD Image - Installation
Aspose.PSD for .NET API supports creating, editing, or manipulating PSD and several other supported file formats. You can configure the API by downloading its DLL file from the Downloads section or with the following NuGet command:
PM> Install-Package Aspose.PSD
Create a PSD Image using C#
A PSD file can contain one or more layers. For instance, a text layer, image layer, shapes layer, etc. In this example, we will add shapes like a rectangle and ellipse, as well as a text layer for demonstration. You need to follow the steps below to create a PSD image using C#:
- Create a new image using the PsdImage class.
- Clear the image data and add a rectangle and ellipse drawing.
- Add a text layer with any text string.
- Write the output PSD file using the Save method.
The following code snippet explains how to create a PSD image programmatically in C#:
Explore API Features
You may take a look at the documentation to check several other features offered by the API.
Get Free Evaluation License
You can evaluate the API in full capacity without any evaluation limitations by requesting a free temporary license.
In this article, you have learned how to create a PSD image programmatically using C#. You have explored how to draw a rectangle and ellipse by specifying the coordinates and the color of the shapes. Likewise, a text layer is also added to the PSD image to explain how simply you can integrate these features in your image processing applications. Furthermore, please feel free to reach out to us at the forum in case of any queries.