B
Bruce D
I'm having a problem saving my bitmap in my MySQL database. Apparently it's
too big...but it shouldn't be. Here's what I got:
Dim bmpDocument As Bitmap = Bitmap.FromHbitmap(hDibCopy) ' get image from
scanner
Dim bmpResize As New Bitmap(bmpDocument, 680, 880)
mySQLManager.InsertDBImage(elmImageIndex, intNextDocument, bmpResize)
Public Function InsertDBImage(ByVal ImageElement As XmlElement, _
ByVal
DocumentID As Integer, _
ByVal tImage
As System.Drawing.Bitmap)
Dim st As New System.IO.MemoryStream
tImage.Save(st, System.Drawing.Imaging.ImageFormat.Bmp)
Dim bytBLOBData(st.Length - 1) As Byte
'st.Position = 0
st.Seek(0, IO.SeekOrigin.Begin)
st.Read(bytBLOBData, 0, st.Length)
MsgBox(bytBLOBData.Length) ' this displays
2393654...way too big
Now if I save the image to file and then use that file (as opposed to the
hDibCopy) the lenght is 87467...which is small enough to insert into my
database.
Am I doing something wrong? Why is it so big?
Any help is greatly appreciated.
-bruce duncan
too big...but it shouldn't be. Here's what I got:
Dim bmpDocument As Bitmap = Bitmap.FromHbitmap(hDibCopy) ' get image from
scanner
Dim bmpResize As New Bitmap(bmpDocument, 680, 880)
mySQLManager.InsertDBImage(elmImageIndex, intNextDocument, bmpResize)
Public Function InsertDBImage(ByVal ImageElement As XmlElement, _
ByVal
DocumentID As Integer, _
ByVal tImage
As System.Drawing.Bitmap)
Dim st As New System.IO.MemoryStream
tImage.Save(st, System.Drawing.Imaging.ImageFormat.Bmp)
Dim bytBLOBData(st.Length - 1) As Byte
'st.Position = 0
st.Seek(0, IO.SeekOrigin.Begin)
st.Read(bytBLOBData, 0, st.Length)
MsgBox(bytBLOBData.Length) ' this displays
2393654...way too big
Now if I save the image to file and then use that file (as opposed to the
hDibCopy) the lenght is 87467...which is small enough to insert into my
database.
Am I doing something wrong? Why is it so big?
Any help is greatly appreciated.
-bruce duncan