Reputation: 520
am trying to use image resizer.ImageJob in my mvc 4 to crop and save image as it is being uploaded. here is my code.
`//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();
`
my problem is that i keep getting exception to specify the encoder to be used in processing the image. Whenever theProcessedImage.Build() is called. So how do i specify the encoder, i have installed the nuget (Install-Package ImageResizer.Plugins.Wic) package following the instruction i found on the imageresizing site
Upvotes: 0
Views: 728
Reputation: 16468
jpeg
, png
, gif
, and webp
are currently the only valid output formats.If it's asking for the decoder, not the encoder, then the source file type is probably not supported, or you don't have the FreeImageDecoder plugin installed.
Upvotes: 1