我有图像,但在重新调整大小时质量很差
我的代码:
string sFile = "D:\\Testing\\" + txtnewname.Text;
Bitmap newImage = new Bitmap(Convert.ToInt32(txtwidth.Text), Convert.ToInt32(txtHeight.Text));
newImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
using (Graphics gr = Graphics.FromImage(newImage))
{
gr.SmoothingMode = SmoothingMode.HighQuality;
gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
gr.PixelOffsetMode = PixelOffsetMode.HighQuality;
gr.DrawImage(image, new Rectangle(0, 0, (Convert.ToInt32(txtwidth.Text)), Convert.ToInt32(txtHeight.Text)));
}
newImage.Save(sFile + ".jpeg", ImageFormat.Jpeg);