Crop Rotate PSD csharp

PSD images are frequently used to design graphics and visuals. In some cases, you might want to crop or rotate a PSD image for different aesthetic requirements. In this article, you will learn how to crop or rotate a PSD image using C#. Please go through the following headings for more information:

Rotate or Crop a PSD Image – C# .NET API Installation

Aspose.PSD for .NET API supports creating, editing, and manipulating PSD and many other Photoshop file formats. You can easily set up the API by downloading the DLL file from the New Releases, or with the following NuGet installation command in Microsoft Visual Studio:

PM> Install-Package Aspose.PSD

Crop a PSD Image with Shift Approach using C#

You can crop a PSD image by moving the contents towards the center of the image. The following steps show how to crop a PSD image while shifting contents:

  1. Load the input PSD image using the RasterImage class instance.
  2. Cache the PSD image with CacheData method.
  3. Specify the shift values and call the Crop method.
  4. Save the output cropped image.

The code snippet explains how to crop a PSD image programmatically in C#:

Crop a PSD Image with Rectangular Coordinates in C#

You can crop any portion of a PSD image by using rectangular coordinates. Please follow the steps below in order to crop the PSD image with Rectangular coordinates:

  1. Load the input PSD file with RasterImage class.
  2. Cache the input image for enhanced performance.
  3. Initialize a Rectangle class object with the desired coordinates.
  4. Crop the PSD image and save the output file.

The following code snippet demonstrates how to crop a PSD image using rectangular coordinates in C#:

Rotate a PSD Image at any Angle using C#

You can rotate a PSD image at any angle with the following steps:

  1. Load the input PSD image with RasterImage class.
  2. Cache the image improved performance.
  3. Set the angle of rotation in the Rotate method.
  4. Save the rotated output PSD file.

The code snippet below explains how to rotate a PSD image programmatically in C#:

Get Free Evaluation License

You can request a free evaluation license to test the API in its full capacity.

Conclusion

In conclusion, you have learned how to crop or rotate a PSD image programmatically with C#. You can integrate the feature into your .NET-based applications. Please visit the documentation section for further details and feel free to write to us at the free support forum, in case of any inquiries.

See Also