如何在 C# 中调整图像的宽度而不使用 image.resize() 调整高度
当我这样做时:
image.Resize(width: 800, preserveAspectRatio: true,preventEnlarge:true);
这是完整的代码:
var imagePath = "";
var newFileName = "";
var imageThumbPath = "";
WebImage image = null;
image = WebImage.GetImageFromRequest();
if (image != null)
{
newFileName = Path.GetFileName(image.FileName);
imagePath = @"pages/"+newFileName;
image.Resize(width:800, preserveAspectRatio:true, preventEnlarge:true);
image.Save(@"~/images/" + imagePath);
imageThumbPath = @"pages/thumbnail/"+newFileName;
image.Resize(width: 150, height:150, preserveAspectRatio:true, preventEnlarge:true);
image.Save(@"~/images/" + imageThumbPath);
}
我收到此错误消息:
方法“调整大小”没有重载需要 3 个参数