我在保存此Bitmap
时遇到问题。我尝试了ImageFormat.Jpg
格式但结果相同。我确信这条道路是真的。
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);
我的错误很有名,除非在gdi +中发生了一般性错误。你有什么建议吗?
由于
答案 0 :(得分:2)
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);