I am trying to re-size uploaded images. From what I have found online, the way to do this is to create a new image the size that you want it to be and then use Graphics to draw the image to a smaller image. The seems to work for every image that is uploaded except for images from a Nikon D90 camera. Every time I attempt to upload and re-size on of those images I get an OutOfMemoryException at the line shown below. Can anyone tell me what I'm doing wrong.
'Create the new image as a blank bitmap
Dim resized As Image = New Bitmap(newWidth, newHeight)
'Create a new graphics object from the new image
Dim g As Graphics = Graphics.FromImage(resized)
'Resize graphics object to fit onto the resized image
g.DrawImage(originalImage, New Rectangle(0, 0, resized.Width, resized.Height)) <-- Exception
g.Dispose()