我正在尝试调整文件夹中的图像大小。我正在使用的代码是这样的:
string logoUrl = HttpContext.Current.Server.MapPath("DeviceLogo");
System.Drawing.Image SourceLogo = System.Drawing.Image.FromFile(logoUrl + @"\" + objDevice.FileName);
//Create a logo for this device and reseller/client business
Bitmap newImage = new Bitmap(objDevice.LogoWidth, objDevice.LogoHeight, PixelFormat.Format24bppRgb);
using (Graphics graphics = Graphics.FromImage(newImage))
{
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.DrawImage(SourceLogo, 0, 0, objDevice.LogoWidth, objDevice.LogoHeight);
}
string filepath = HttpContext.Current.Server.MapPath("DeviceLogo");
//Save the resized image
newImage.Save(filepath + objDevice.FileName);
问题是图像没有调整大小