保存图像GDI +错误

时间:2017-03-25 18:41:18

标签: vb.net image gdi+

我已经研究过这个错误并调整了我的代码(下面),但我仍然得到了#34;泛型GDI +错误"。任何建议都非常感谢。

 Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click

    mPictureBox.Image.Save("C:\Users\Public\Desktop\img.bmp")

End Sub

Private Sub btnOpen_Click(sender As Object, e As EventArgs) Handles btnOpen.Click
    Dim dlg As New OpenFileDialog
    If dlg.ShowDialog = DialogResult.OK Then
        Dim ms As New MemoryStream(File.ReadAllBytes(dlg.FileName))
        Dim img As Image = Image.FromStream(ms)
        mPictureBox.Image = img
        origImage = mPictureBox.Image
        btnRotateRight.Enabled = True
    End If

End Sub

1 个答案:

答案 0 :(得分:0)

您可以尝试将其强制保存为位图:

    mPictureBox.Image.Save("C:\Users\Public\Desktop\img.bmp", Imaging.ImageFormat.Bmp)

希望这有帮助!