public static Bitmap Resize(Image img, int width, int height)
{
//create a new Bitmap the size of the new image
Bitmap bmp = new Bitmap(width, height);
//create a new graphic from the Bitmap
Graphics graphic = Graphics.FromImage((Image)bmp);
graphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphic.SmoothingMode = SmoothingMode.HighQuality;
graphic.CompositingQuality = CompositingQuality.HighQuality;
graphic.PixelOffsetMode = PixelOffsetMode.HighQuality;
//draw the newly resized image
graphic.DrawImage(img, 0, 0, width, height);
//dispose and free up the resources
graphic.Dispose();
//return the image
return bmp;
}