1) Быстрый способ, очень низкое качество для больших картинок:
public static Image ResizeImage( Image img, int newWidth, int newHeight ) {
return img.GetThumbnailImage( newWidth, newHeight, null, IntPtr.Zero );
}
2) Качественный способ:
public static Image ResizeImage( Image img, int newWidth, int newHeight ) {
Image thumbImg = new Bitmap( newWidth, newHeight );
using( Graphics gr = Graphics.FromImage( thumbImg ) )
{
gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
gr.DrawImage(
img,
new Rectangle( 0, 0, newWidth, newHeight ),
0, 0,
img.Width, img.Height,
GraphicsUnit.Pixel
);
}
return thumbImg;
}