|
BitmapExtensionsCrop(Image, Rectangle) Method
|
Returns a cropped
Bitmap image of the original.
Namespace: GSF.DrawingAssembly: GSF.Core (in GSF.Core.dll) Version: 2.4.284-beta+805ed69bbaa748bda5f49830845a2ffff2791ae0
Syntax
Example
This example shows how to crop an image:
using System;
using System.Drawing;
using GSF.Drawing;
class Program
{
static void Main(string[] args)
{
// Load the original image.
Bitmap original = (Bitmap)Bitmap.FromFile("Original.jpg");
// Crop the original image.
Bitmap originalCropped = original.Crop(new Rectangle(0, 0, 300, 300));
// Save the cropped image to file.
originalCropped.Save("OriginalCropped.jpg");
// Clean-up.
original.Dispose();
originalCropped.Dispose();
Console.ReadLine();
}
}
See Also