Hi guys, trying to fix a problem with an image resize routine. The code
posted below uploads and resizes a jpeg, probablem is, the outlook can look
a bit bitty becuase of teh samller size...is there a way I can anti alias /
smooth the resized image before saving?
If myThumb.ContentLength > 0 Then
Dim myThumbData(myThumb.ContentLength) As Byte
myThumb.InputStream.Read(myThumbData, 0, myThumb.ContentLength)
Dim FileStream As New System.IO.FileStream(strTempSavePath &
"rawupload-thumb.jpg", IO.FileMode.Create)
FileStream.Write(myThumbData, 0, myThumb.ContentLength)
FileStream.Close()
' Create New image and bitmap objects. Load the image file and put into a
resized bitmap.
Dim g As System.Drawing.Image =
System.Drawing.Image.FromFile(strTempSavePath & "rawupload-thumb.jpg")
Dim thisFormat = g.RawFormat
Dim intThumbSize As New Size
intThumbSize = NewImageSize(g.Width, g.Height, 90, 90)
' Create bimap in memory to manipulate image.
Dim imgOutput As New Bitmap(g, intThumbSize.Width, intThumbSize.Height)
Response.ContentType = "image/jpeg"
' Resize done, now save the file back to the temp directory.
imgOutput.Save(strTempSavePath & "upload-thumb.jpg", thisFormat)
' Tidy up the objects
g.Dispose()
imgOutput.Dispose()
' Set URL for uploaded image to be previwed on page where this control is
included.
imgThumb.ImageUrl = "/catalogue/images/tmp/upload-thumb.jpg"
imgThumb.Visible = True
End If