RasterCachedImageCrop Method (Rectangle)
Cropping the image.

Namespace: Aspose.Imaging
Assembly: Aspose.Imaging (in Aspose.Imaging.dll) Version: 20.06
Syntax
public override void Crop(
	Rectangle rectangle
)

Parameters

rectangle
Type: Aspose.ImagingRectangle
The rectangle.
Examples
The following example crops a raster cached image. The cropping area is be specified via Aspose.Imaging.Rectangle.
[C#]

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

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

    // Crop the image. The cropping area is the rectangular central area of the image.
    Aspose.Imaging.Rectangle area = new Aspose.Imaging.Rectangle(rasterImage.Width / 4, rasterImage.Height / 4, rasterImage.Width / 2, rasterImage.Height / 2);
    rasterImage.Crop(area);

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