大家好,我想问一下如何在不损失质量的情况下调整图像大小?
这是我的控制器方法
var fileName = DateTime.Now.ToString("MM.dd.yyyy HH.mm.ss") + Path.GetFileName(file.FileName);
var path = Path.Combine(Server.MapPath("~/uploads/"), fileName);
file.SaveAs(path);
System.Drawing.Image img = System.Drawing.Image.FromFile(Server.MapPath("~/uploads/") + fileName);
System.Drawing.Image thumb = img.GetThumbnailImage(97, 114, null, IntPtr.Zero);
img.Dispose();
thumb.Save(Server.MapPath("~/uploads/") + fileName);