I have some code which has been working fine, but suddenly I am getting an
error that I need help with.
Here is the code:
Dim tImg As Image
Dim inStrm, outStrm As MemoryStream
Dim bBlob() As Byte
Try
inStrm = New MemoryStream(nPhoto.TnailFile)
tImg = Image.FromStream(inStrm)
Dim propIDs() As Integer = tImg.PropertyIdList
Dim propID As Integer
If propIDs.Length > 0 Then
' First create a "dummy" PropertyItem to use
' This is necessary because VB.NET has no "New" method to
create
' a new PropertyItem, so we are going to "hijack" an
existing one
Dim pItem As Imaging.PropertyItem =
tImg.GetPropertyItem(propIDs(0))
' See if we have a PropertyItem for the image width
tImg.SetPropertyItem(LoadProperty(pItem, &HA002, 4, width))
tImg.SetPropertyItem(LoadProperty(pItem, &HA003, 4, height))
End If
outStrm = New MemoryStream
tImg.Save(outStrm, Imaging.ImageFormat.Jpeg)
bBlob = outStrm.ToArray
The error occurs in the tImg.Save method. The error is "A generic error
occurred in GDI+"
Essentially what I'm doing is getting an image (tImg) from a database
(nPhoto.TnailFile), changing two property tags with new width and height
values, and saving back to the database (bBlob).
The code has been running fine for some time, but this error just popped up
and I can't seem to get around it.
Any help would be greatly appreciated.
Thanks
--
Walt