任何人都可以帮我解决下面的代码吗?我在第4行得到了“论据例外”。 InnerException是Nothing。
Using btm As Bitmap = Image.FromStream(importFile.InputStream)
Using newImage As Bitmap = ResizeImage(btm, StoringSize)
Dim stream As New MemoryStream
newImage.Save(stream, Imaging.ImageFormat.Bmp) 'Argument exception occurred. Parameter is not valid
StoringFilesHelper.SaveFile(fileName, stream, folderType)
End Using
End Using
此代码无任何例外:
Using btm As Bitmap = Image.FromStream(importFile.InputStream)
Using newImage As Bitmap = ResizeImage(btm, StoringSize)
'Dim stream As New MemoryStream
'newImage.Save(stream, Imaging.ImageFormat.Jpeg)
'StoringFilesHelper.SaveFile(fileName, Stream, folderType)
Dim filePath As String = StoringFilesHelper.GetLocalPath(fileName, folderType)
newImage.Save(filePath)
End Using
End Using
最后,我明白了。 http://blog.lavablast.com/post/2007/11/29/The-Mysterious-Parameter-Is-Not-Valid-Exception.aspx 图像以ResizeImage方法处理。
答案 0 :(得分:0)
尝试不使用此行运行代码:
StoringFilesHelper.SaveFile(fileName, stream, folderType)