Hello,
If you can upload a file to the server then you can use the following code to resample the image to the size you want. I wrote it a wile ago. If you have problems post again.
Regards
Brin
______________________________________________________________________
'need these imports at top
Import System.Drawing.Bitmap
Import System.Drawing.Imaging
Import System.Drawing
'************ Resize image ********************
'load the uploaded photo on the server
Dim TheImage AS System.Drawing.Image = System.Drawing.Image.FromFile(Server.MapPath("path/fileName"))
Dim TheBitmap As bitmap = new bitmap(TheImage)
Dim TheWidth as integer = TheBitmap.Width
Dim TheHeight as integer = TheBitmap.Height
Dim NewWidth, NewHeight as integer
'test if horizontal or vertical orintated
if TheWidth > TheHeight then
' Set the new width and height of the photo
' **horizontal**
'Resize photo and maintain aspect ratio
NewWidth = 500
NewHeight = (TheHeight/(TheWidth/NewWidth))
else
'**vertical**
'Resize photo and maintain aspect ratio
NewHeight = 450
NewWidth = (TheWidth/(TheHeight/NewHeight))
end if
'reload the photo at the resampled size
Dim NewBitmap As bitmap = new bitmap(TheImage, NewWidth, NewHeight) '
'Save the photo
NewBitmap.Save(MapPath("path/fileName.jpg"), ImageFormat.Jpeg)
TheImage.Dispose() 'Free image from server
Enter your message below
Sign in or Join us (it's free).