PsdImageRotate Method (Single)
Rotate image around the center.

Namespace: Aspose.PSD.FileFormats.Psd
Assembly: Aspose.PSD (in Aspose.PSD.dll) Version: 20.11
Syntax
public override void Rotate(
	float angle
)

Parameters

angle
Type: SystemSingle
The rotate angle in degrees. Positive values will rotate clockwise.
Examples
The following code demonstrates ability to rotate the image by specific angle value.
[C#]

string sourceFileName = "TheHat.psd";
var pngOptions = new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha };

// Whole image rotating
using (PsdImage image = (PsdImage)Image.Load(sourceFileName))
{
    for (int i = 0; i < 4; i++)
    {
        int angle = i * 45;
        image.Rotate(angle);

        string outFileName = "TheHatRotated" + angle + ".png";

        image.Save(outFileName, pngOptions);
    }
}

// Layer rotating
using (PsdImage image = (PsdImage)Image.Load(sourceFileName))
{
    for (int i = 0; i < 4; i++)
    {
        int angle = i * 45;
        image.Layers[1].Rotate(angle);

        string outFileName = "TheHatLayerRotated" + angle + ".png";

        image.Save(outFileName, pngOptions);
    }
}
See Also