public static void Run()
{
// ExStart:ExpandOrCropAnImage
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages();
// Load an image in an instance of Image and Setting for image data to be cashed
using (RasterImage rasterImage = (RasterImage)Image.Load(dataDir + "aspose-logo.jpg"))
{
rasterImage.CacheData();
// Create an instance of Rectangle class and define X,Y and Width, height of the rectangle, and Save output image
Rectangle destRect = new Rectangle { X = -200, Y = -200, Width = 300, Height = 300 };
rasterImage.Save(dataDir + "Grayscaling_out.jpg", new JpegOptions(), destRect);
}
// ExEnd:ExpandOrCropAnImage
}
}