- Code: Select all
...
ReDim pixels(SquareHeight * tsImageWidth * 4)
pictureImaging.GetPixelArrayByte(timesheetImage, pixels, 0, topLeftYCor + ((rowNr - 1) * SquareHeight), tsImageWidth, SquareHeight)
Dim taskByte() As Byte = pixels
Dim taskMS As New MemoryStream(taskByte)
Dim taskImage As Image = Image.FromStream(taskMS) <== ArgumentException
Dim task As New Bitmap(taskImage)
Whereas when I use an existing image, convert it to a byte array and pass it to the FromStream method, it works like a charm.
