我正在尝试在我的 mvc 4 中使用图像 resizer.ImageJob 来裁剪和保存正在上传的图像。这是我的代码。
`//create cropping point information using the nameValueCollections specified in the image;
System.Drawing.PointF point1 = new SD.PointF(collectionsValues["x1Cords"], collectionsValues["y1Cords"]);
System.Drawing.PointF point2 = new SD.PointF(collectionsValues["x2Cords"], collectionsValues["y2Cords"]);
//Setup the resize settings
var resizeSettings = new ResizeSettings();
resizeSettings.CropXUnits = collectionsValues["widthOfSelection"];
resizeSettings.CropYUnits = collectionsValues["heightOfSelection"];
resizeSettings.Format = file.ContentType;
resizeSettings.CropTopLeft = point1;
resizeSettings.CropBottomRight = point2;
resizeSettings.Mode = FitMode.Crop;
//construct the image and save it in the disk.
ImageJob theProcessedImage = new ImageJob(file, imagePath, resizeSettings, true, false);
theProcessedImage.CreateParentDirectory = true;
theProcessedImage.Build();
`
我的问题是我不断收到异常来指定要用于处理图像的编码器。每当调用 theProcessedImage.Build()时。那么如何指定编码器,我已经按照我在 imageresizing 站点上找到的说明安装了nuget (Install-Package ImageResizer.Plugins.Wic)包