GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / Crop Method
GdPicture image identifier.
Left source pixel.
Top source pixel.
Width in pixel.
Height in pixel.
Example





Crop Method (GdPictureImaging)
Crops a custom area of a GdPicture image.
Syntax
'Declaration
 
Public Function Crop( _
   ByVal ImageID As Integer, _
   ByVal Left As Integer, _
   ByVal Top As Integer, _
   ByVal Width As Integer, _
   ByVal Height As Integer _
) As GdPictureStatus
 

Parameters

ImageID
GdPicture image identifier.
Left
Left source pixel.
Top
Top source pixel.
Width
Width in pixel.
Height
Height in pixel.

Return Value

A member of the GdPictureStatus enumeration.
Remarks

This method requires the Image Documents component to run.

Example
Cropping from a jpeg image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg");
 
    // Remove 5% all around the image.
    int height = gdpictureImaging.GetHeight(imageID);
    int width = gdpictureImaging.GetWidth(imageID);
    gdpictureImaging.Crop(imageID, width * 5 / 100, height * 5 / 100, width * 90 / 100, height * 90 / 100);
    gdpictureImaging.SaveAsPNG(imageID, "crop.png");
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also