Possible Duplicate:
Resizing an Image without losing any quality
I'm resizing images using the following method:
public static Bitmap Resize(Image source, int width, int height)
{
Bitmap bitmap = new Bitmap(width, height);
using (Graphics graphics = Graphics.FromImage(bitmap))
{
graphics.SmoothingMode = SmoothingMode.AntiAlias;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
graphics.DrawImage(source, new Rectangle(0, 0, width, height));
}
return bitmap;
}
The output image quality is terrible bad. Is there a way to resize the image without messing up the quality?
PS: the image source width and height is always bigger than the width and height parameters and the width and height ratio is being preserved.