| 
            
              BitmapExtensionsCrop(Image, Rectangle) Method
             | 
          
        
        
             Returns a cropped Bitmap image of the original.
             
        
        Namespace: GSF.DrawingAssembly: GSF.Core (in GSF.Core.dll) Version: 2.4.257-beta+00aa2366fbb9ec75f636ebc7cfa610e3826a727c
Syntaxpublic static Bitmap Crop(
	this Image originalImage,
	Rectangle croppedArea
)
<ExtensionAttribute>
Public Shared Function Crop ( 
	originalImage As Image,
	croppedArea As Rectangle
) As Bitmap
public:
[ExtensionAttribute]
static Bitmap^ Crop(
	Image^ originalImage, 
	Rectangle croppedArea
)
[<ExtensionAttribute>]
static member Crop : 
        originalImage : Image * 
        croppedArea : Rectangle -> Bitmap GSF.Drawing.BitmapExtensions.Crop = function(originalImage, croppedArea);
 View SourceParameters
- originalImage  Image
 - The original Bitmap image to be cropped.
 - croppedArea  Rectangle
 - The Rectangle area of the original image to be cropped.
 
Return Value
BitmapA 
Bitmap instance.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type 
Image. When you use instance method syntax to call this method, omit the first parameter. For more information, see 
Extension Methods (Visual Basic) or 
Extension Methods (C# Programming Guide).
Example
             This example shows how to crop an image:
             
using System;
using System.Drawing;
using GSF.Drawing;
class Program
{
    static void Main(string[] args)
    {
        
        Bitmap original = (Bitmap)Bitmap.FromFile("Original.jpg");
        
        Bitmap originalCropped = original.Crop(new Rectangle(0, 0, 300, 300));
        
        originalCropped.Save("OriginalCropped.jpg");
        
        original.Dispose();
        originalCropped.Dispose();
        Console.ReadLine();
    }
}
See Also