例如,這裏是示例JPEG,我不能保存(!),但可以使用標準的dotnet類讀取(例如查找寬度和高度)。原始文件:JPEG操作和dotnet - GDI +例外
http://dl.dropbox.com/u/5079317/184809_1_original.jpg
在Windows圖像編輯器保存同一圖像後,所有的偉大工程: http://dl.dropbox.com/u/5079317/184809_1_resaved.jpg
我很久以前就注意到了這個錯誤,但它不是主要問題。但在目前的項目中,我有成千上萬的這樣的圖像,我真的需要某種解決方案。
可以使用哪些第三方庫?
這裏是我正在讀:
public ImageFile SaveImage(HttpPostedFileBase file, string fileNameWithPath, bool splitImage, out string errorMessage)
{
try
{
using (var stream = file.InputStream)
{
using (Image source = Image.FromStream(stream))
{
return SaveImage(source, fileNameWithPath, splitImage, out errorMessage);
// which actually do source.Save(fileNameWithPath, ImageFormat.Jpeg);
// Exception: A generic error occurred in GDI+.
}
}
}
catch (Exception e)
...
}