---
title: "TransformsProvider..::.Crop Method (Int32, Int32, Int32, Int32, Color)"
canonical: https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_TransformsProvider_Crop_5_f2ef09d9.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# TransformsProvider.Crop Method (Int32, Int32, Int32, Int32, Color)
 
Crops the image using specified rectangle (which is not obligatory totally inside the bitmap).
 
**Namespace:** [Aurigma.GraphicsMill](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```
Public Sub Crop ( _x As Integer, _y As Integer, _width As Integer, _height As Integer, _backgroundColor As Color _
)
```
 
```csharp
public void Crop(int x,int y,int width,int height,Color backgroundColor
)
```
 
### Parameters
 
 - x
     - Type: [System.Int32](http://msdn2.microsoft.com/en-us/td2s409d)
X-coordinate of the cropping rectangle.

 - y
     - Type: [System.Int32](http://msdn2.microsoft.com/en-us/td2s409d)
Y-coordinate of the cropping rectangle.

 - width
     - Type: [System.Int32](http://msdn2.microsoft.com/en-us/td2s409d)
Width of the cropping rectangle.

 - height
     - Type: [System.Int32](http://msdn2.microsoft.com/en-us/td2s409d)
Height of the cropping rectangle.

 - backgroundColor
     - Type: [Aurigma.GraphicsMill.Color](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Color.htm.md)
Background color which is used when cropping rectangle takes pixels which are out of the image.
 
## Remarks
 You can also use [Crop](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Transforms_Crop.htm.md) class to crop the image.
 
## Examples
  
```
Dim offset As Integer = 20

'Crop in
bitmap.Transforms.Crop(offset, offset, _
    bitmap.Width - 2 * offset, bitmap.Height - 2 * offset)

'Add vignette
bitmap.Transforms.Buttonize(50, Aurigma.GraphicsMill.Transforms.FadeType.Nonlinear, _
    Aurigma.GraphicsMill.Transforms.Direction.UpLeft, _
    Aurigma.GraphicsMill.RgbColor.Black, _
    Aurigma.GraphicsMill.RgbColor.Black)

'Crop out
bitmap.Transforms.Crop(-offset, -offset, _
    bitmap.Width + 2 * offset, bitmap.Height + 2 * offset, _
    Aurigma.GraphicsMill.RgbColor.Black)
```
 
```csharp
const int offset = 20;
 
//Crop in
bitmap.Transforms.Crop(offset, offset, 
    bitmap.Width - 2 * offset, bitmap.Height - 2 * offset);

//Add vignette
bitmap.Transforms.Buttonize(50, Aurigma.GraphicsMill.Transforms.FadeType.Nonlinear, 
    Aurigma.GraphicsMill.Transforms.Direction.UpLeft, 
    Aurigma.GraphicsMill.RgbColor.Black, 
    Aurigma.GraphicsMill.RgbColor.Black);

//Crop out
bitmap.Transforms.Crop(-offset, -offset, 
    bitmap.Width + 2 * offset, bitmap.Height + 2 * offset, 
    Aurigma.GraphicsMill.RgbColor.Black);
```
   
## See Also

### Reference

- [TransformsProvider Class](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_TransformsProvider.htm.md)
- [Crop Overload](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_TransformsProvider_Crop.htm.md)
- [Aurigma.GraphicsMill Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill.htm.md)
