Cropping Image

Use the following code to crop an image by C#.

public Image CropImage(Image img, int cropLeft, int cropTop, int cropWidth, int cropHeight)
{
Bitmap bmp = new Bitmap(img);
Rectangle rect = new Rectangle(cropLeft, cropTop, cropWidth, cropHeight);
Bitmap croppedBmp = bmp.Clone(rect, bmp.PixelFormat);
return croppedBmp;
}


....S.VinothkumaR.

No comments: