RasterImageCrop Method (Int32, Int32, Int32, Int32)
Crop image with shifts.

Namespace: Aspose.Imaging
Assembly: Aspose.Imaging (in Aspose.Imaging.dll) Version: 20.06
Syntax
public virtual void Crop(
	int leftShift,
	int rightShift,
	int topShift,
	int bottomShift
)

Parameters

leftShift
Type: SystemInt32
The left shift.
rightShift
Type: SystemInt32
The right shift.
topShift
Type: SystemInt32
The top shift.
bottomShift
Type: SystemInt32
The bottom shift.
Examples
The following example crops a raster image. The cropping area is specified via Left, Top, Right, Bottom margins.
[C#]

string dir = @"c:\temp\";

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
    Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;

    // Crop again. Set a margin of 10% of the image size.
    int horizontalMargin = rasterImage.Width / 10;
    int verticalMargin = rasterImage.Height / 10;
    rasterImage.Crop(horizontalMargin, horizontalMargin, verticalMargin, verticalMargin);

    // Save the cropped image to PNG.
    rasterImage.Save(dir + "sample.Crop.png");
}
See Also