RasterImageCrop Method (Rectangle)
Crops the specified rectangle.

Namespace: Aspose.PSD
Assembly: Aspose.PSD (in Aspose.PSD.dll) Version: 20.10
Syntax
public virtual void Crop(
	Rectangle rectangle
)

Parameters

rectangle
Type: Aspose.PSDRectangle
The rectangle.
Examples
The following code example shows how to crop an image and save it.
[C#]

// Implement correct Crop method for PSD files.
string sourceFileName = "1.psd";
string exportPathPsd = "CropTest.psd";
string exportPathPng = "CropTest.png";
using (RasterImage image = Image.Load(sourceFileName) as RasterImage)
{
    image.Crop(new Rectangle(10, 30, 100, 100));
    image.Save(exportPathPsd, new PsdOptions());
    image.Save(exportPathPng, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}
See Also