GifImage.Crop method

Cropping the image.

public override void Crop(Rectangle rectangle)
Parameter Type Description
rectangle Rectangle The rectangle.


The following example crops a GIF image. The cropping area is be specified via Aspose.Imaging.Rectangle.


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

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
    Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;

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

    // Save the cropped image to PNG
    gifImage.Save(dir + "sample.Crop.png", new Aspose.Imaging.ImageOptions.PngOptions());

See Also