Crop Method (GdPictureImaging)
public function Crop(
: Integer;
: Integer;
: Integer;
: Integer;
: Integer
): GdPictureStatus;
public function Crop(
: int,
: int,
: int,
: int,
: int
) : GdPictureStatus;
'Declaration
Public Function Crop( _
ByVal As Integer, _
ByVal As Integer, _
ByVal As Integer, _
ByVal As Integer, _
ByVal 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.
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);
}