/// <summary>
/// Method for resizing an image
/// </summary>
/// <param name="img">The image to resize</param>
/// <returns></returns>
public Image Resize(Image img)
{
const int StandartH = 1400;
//get the height and width of the image
int originalW = (img.Width * (int)img.VerticalResolution)/72;
int originalH = (img.Height * (int)img.HorizontalResolution)/72;
//No need to change the size of this image
if (originalW <= StandartH) return img;
int percentage =100 - ((StandartH * 100) / originalW);
//get the new size based on the percentage change
int resizedW = originalW - ((originalW * percentage) / 100);
int resizedH = originalH - ((originalH * percentage) / 100);
//create a new Bitmap the size of the new image
Bitmap bmp = new Bitmap(resizedW, resizedH);
bmp.SetResolution(72, 72);
//create a new graphic from the Bitmap
Graphics graphic = Graphics.FromImage((Image)bmp);
graphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
//draw the newly resized image
graphic.DrawImage(img, 0, 0, resizedW, resizedH);
//dispose and free up the resources
graphic.Dispose();
//return the image
return (Image)bmp;
}