RasterCachedImage.Crop

RasterCachedImage.Crop method

Cropping the image.

public override void Crop(Rectangle rectangle)
ParameterTypeDescription
rectangleRectangleThe 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