Reputation: 5930
I have problem with saving this Bitmap
. I tried the ImageFormat.Jpg
format but with the same result. I am sure of that path is true.
string filePathTemp = Server.MapPath("..") + @"\ProductImages\Temp\";
ImageProcessor imageProcessor = new ImageProcessor();
fuProductImage.SaveAs(filePathTemp + fuProductImage.FileName);
Bitmap orgImage = new Bitmap(filePathTemp + fuProductImage.FileName);
Bitmap resizedLargeImage = imageProcessor.Resize(orgImage, 350, 350);
resizedLargeImage.Save(filePathLarge, ImageFormat.Bmp);
My error is famous save a generic error occurred in gdi+. Do you have any suggestoin?
Thanks
Upvotes: 1
Views: 3307
Reputation: 5930
ImageConverter img_converter = new ImageConverter();
System.Drawing.Image img = imageProcessor.Resize(orgImage, width, height);
byte[] bytes = (byte[])img_converter.ConvertTo(img, typeof(byte[]));
File.WriteAllBytes(filePath + fileName, bytes);
Upvotes: 2