hey guys, i'm getting a Generic GDI+ error when saving an image to a filepath... The reason this is so odd, is the first image which i make (bmpNew) is where i get the error... however, the second image (bmpNewThumb) saves perfectly fine... both images are just sizes of the main image (bmpMain)

anyways, here's my code.. i've been picking through it forever and can't seem to find what's wrong...

VB Code:
  1. ' Declarations
  2.                     Dim intWidth As Integer
  3.                     Dim intHeight As Integer
  4.                     Dim sizeMain As SizeF
  5.                     Dim sizeNew As SizeF
  6.                     Dim sizeNewThumb As SizeF
  7.                     Dim fScale As Single
  8.  
  9.                     ' New Bitmaps for modified images
  10.                     Dim bmpNew As Bitmap
  11.                     Dim bmpNewThumb As Bitmap
  12.  
  13.                     ' Get Uploaded picture
  14.                     Dim bmpMain As New Bitmap(filePicture.PostedFile.InputStream)
  15.  
  16.                     'Get the original size of the picture
  17.                     sizeMain = New SizeF(bmpMain.Width / bmpMain.HorizontalResolution, bmpMain.Height / bmpMain.VerticalResolution)
  18.  
  19.  
  20.                     ' Create the Main Picture and save it
  21.                     ' Set the maximum picture width
  22.                     intWidth = 200
  23.                     intHeight = 200
  24.  
  25.                     'Always resize this image, to keep things constant
  26.                     If CInt(sizeMain.Width) > intWidth Or CInt(sizeMain.Height) > intHeight Then
  27.  
  28.                         'Get scale at how to change image
  29.                         fScale = Math.Min(intWidth / sizeMain.Width, intHeight / sizeMain.Height)
  30.  
  31.                         'Get new image size
  32.                         sizeNew = New SizeF(sizeMain.Width, sizeMain.Height)
  33.  
  34.  
  35.                         ' Calculate the new height and width
  36.                         sizeNew.Width *= fScale
  37.                         sizeNew.Height *= fScale
  38.  
  39.                         'Get Thumbnail
  40.                         bmpNew = bmpMain.GetThumbnailImage(CInt(sizeNewThumb.Width), CInt(sizeNewThumb.Height), Nothing, Nothing)
  41.                     Else
  42.                         bmpNew = bmpMain
  43.                     End If
  44.  
  45.                     'Finally save the image
  46.                     bmpNew.Save(ConfigurationSettings.AppSettings("ImageDataPath") & lblProductID.Text & "_TEMP.jpg", Drawing.Imaging.ImageFormat.Jpeg)
  47.  
  48.                     'Create the Thumbnail Image
  49.                     'Set Thumbnail dimensions
  50.                     intWidth = 75
  51.                     intHeight = 75
  52.  
  53.                     'Always resize this image, to keep things constant
  54.  
  55.                     'Get scale at how to change image
  56.                     fScale = Math.Min(intWidth / sizeMain.Width, intHeight / sizeMain.Height)
  57.  
  58.                     'Get new image size
  59.                     sizeNewThumb = New SizeF(sizeMain.Width, sizeMain.Height)
  60.  
  61.  
  62.                     ' Calculate the new height and width
  63.                     sizeNewThumb.Width *= fScale
  64.                     sizeNewThumb.Height *= fScale
  65.  
  66.                     'Get Thumbnail
  67.                     bmpNewThumb = bmpMain.GetThumbnailImage(CInt(sizeNewThumb.Width), CInt(sizeNewThumb.Height), Nothing, Nothing)
  68.                     bmpNewThumb.Save(ConfigurationSettings.AppSettings("ImageDataPath") & lblProductID.Text & "_TEMP_THUMB.jpg", Drawing.Imaging.ImageFormat.Jpeg)

like i said, the bmpNew.Save is the line where i'm getting the error... it just doesn't add up to me... :/ thanks for the help!