I have an application that performs a screen capture and displays it in a pictureBox contol. This works fine and the quality of the image displayed in the pictureBox is excellent (same quality as on screen), however when I save it to an SQL database and then reload it, the quality is greatly reduced.
I think this is something to do with the way that I am saving the image to SQL?
The code I am using is below:
I then load the byte array into SQL. Is there a better way that I can do this and keep the image quality as good as displayed in the pictureBox?
Thanks in advance
Simon
I think this is something to do with the way that I am saving the image to SQL?
The code I am using is below:
VB.NET:
'Read image into byte
' save image to stream...
Dim clsStream1 As New System.IO.MemoryStream
Me.picPreview.Image.Save(clsStream1, System.Drawing.Imaging.ImageFormat.Jpeg)
' read bytes from stream...
Dim emptyByte As Byte = Nothing
Dim b As Byte() = DirectCast(Array.CreateInstance(GetType(Byte), clsStream1.Length), Byte())
clsStream1.Position = 0
clsStream1.Read(b, 0, b.Length)
clsStream1.Close()
I then load the byte array into SQL. Is there a better way that I can do this and keep the image quality as good as displayed in the pictureBox?
Thanks in advance
Simon