以下两个代码示例是等效的,因为它们会生成缩放图像。也就是说,第二个会产生更高质量的缩放图像吗?我正在使用.NET 4.5。
// The short.
using(Bitmap large = new Bitmap(input, width, height))
{
// Do whatever.
}
// The long.
using(Bitmap large = new Bitmap(width, height))
{
using(Graphics g = Graphics.FromImage(large))
{
g.CompositingQuality = CompositingQuality.HighQuality;
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.DrawImage(input, 0, 0, width, height);
}
// Do whatever.
}