Hey,
Ich habe bereits folgenden Code:
Die bild.jpeg wird zwar erstellt und anscheind auch convertiert aber bei dem Result Covertimage bekomme ich garnichts zurück und das ohne Fehlermeldung warum?
Danke vorraus.
Ich habe bereits folgenden Code:
VB.NET-Quellcode
- 'Screen
- Dim capture As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height)
- Dim Input As Graphics = Graphics.FromImage(capture)
- Input.CopyFromScreen(New Point(0, 0), New Point(0, 0), My.Computer.Screen.Bounds.Size)
- 'Convertieren
- capture.Save(Application.StartupPath & "\bild.jpeg", Imaging.ImageFormat.Jpeg)
- 'String
- Dim imageout As String = ConvertImage.ConvertImageToString(Application.StartupPath & "\bild.jpeg")
- 'My.Computer.FileSystem.DeleteFile(Application.StartupPath & "\bild.jpeg")
- MsgBox(imageout)
- Public Class ConvertImage
- Public Shared Function ConvertImageToString(ByVal Path As String) As String
- Dim Result As String = String.Empty
- If Path Is Nothing Then
- Throw New ArgumentException("Fehler in der Pfaduebergabe...")
- Else
- Try
- If File.Exists(Path) Then
- Dim img As Image = Image.FromFile(Path)
- Using ms As MemoryStream = New MemoryStream
- img.Save(ms, img.RawFormat)
- Dim Bytes() As Byte = ms.ToArray()
- Result = Convert.ToBase64String(Bytes)
- End Using
- Else
- Result = String.Empty
- End If
- Catch ex As Exception
- MessageBox.Show(ex.Message(), "Info")
- End Try
- End If
- Return Result
- End Function
- End Class
Die bild.jpeg wird zwar erstellt und anscheind auch convertiert aber bei dem Result Covertimage bekomme ich garnichts zurück und das ohne Fehlermeldung warum?
Danke vorraus.
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „JackBauer“ ()