Crop image files
The following example shows how to use the GemBox.Imaging component to crop an image by specifying the position (x, y) and the size (width, height).
using GemBox.Imaging;
class Program
{
static void Main()
{
// If using the Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
using (var image = Image.Load("%InputFileName%"))
{
// Crop the image.
image.Crop(150, 24, 170, 260);
// Save the cropped image.
image.Save("Cropped.jpg");
}
}
}
Imports GemBox.Imaging
Module Program
Sub Main()
' If using the Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY")
Using image As Image = Image.Load("%InputFileName%")
' Crop the image.
image.Crop(150, 24, 170, 260)
' Save the cropped image.
image.Save("Cropped.jpg")
End Using
End Sub
End Module
