I'm hoping that one of you has seen this before. I am trying to save an image that is user-selectable in a picturebox control to a bytearray, converting it to a jpeg type (for use in the byte array). Now if I specify a JPEG t ype image when populating the picturebox control and execute my method, then I get the error "A Generic error occurred in GDI+". If I use PNG when populating the picturebox then call the method, it executes just fine! I need to be able ot save to a byte array in the JPEG format to keep the size of the data down but can't seem to get past this hurdle for some reason.
Private Function PicToJPEGByteArray(ByVal bmp As Bitmap) As Byte()
Dim ms As New MemoryStream()
' Save to memory using the Jpeg format
' read to end
Dim bmpBytes As Byte() = ms.GetBuffer()