Asp.net mvc 4 如何使用WebImage调整图像大小?

Asp.net mvc 4 如何使用WebImage调整图像大小?,asp.net-mvc-4,Asp.net Mvc 4,我正在尝试使用WebImage调整图像大小,但我需要所有边都相等,例如:width:200和height:200,但在保存图像后,不会保留其更改为200x65。我怎么能这样做 努力 public class SaveImage{ public static void save(HttpPostedFileBase image, String pathFile, String imgName){ String extension = Path.GetExt

我正在尝试使用WebImage调整图像大小,但我需要所有边都相等,例如:
width:200和height:200
,但在保存图像后,不会保留其更改为
200x65
。我怎么能这样做

努力

public class SaveImage{

    public static void save(HttpPostedFileBase image, String pathFile, String imgName){        
        String extension = Path.GetExtension(image.FileName);
        String pathToSave = HttpContext.Current.Server.MapPath(pathFile);
        WebImage wi = new WebImage(image.InputStream);        
        wi.Resize(width:200, height:200, preserveAspectRatio:true, preventEnlarge:true);
        String imgToSave = Path.Combine(pathToSave, imgName + extension);
        wi.Save(imgToSave);
    }

}

解决了这个问题,我做到了:
wi.Resize(宽度:200,高度:200,保留AspectRatio:false,防止放大:false)很好用。

解决了问题,我做到了:
wi.Resize(宽度:200,高度:200,保留AspectRatio:false,防止放大:false)并且工作正常