'Here you go..
'Put these on top:
Imports System.Drawing.Image
Imports System.Drawing
'And here is the code:
Public Sub DisplaySize(ByVal bmp As Bitmap)
response.write (bmp.Width.ToString())
response.write (bmp.Height.ToString())
End Sub
'shrink the image proportionately so that neither height nor width is
'more than [NewSize] pixels
Public Function ShrinkImage(ByVal bmp As Bitmap, ByVal NewSize As
Integer) As Image
Dim NewWidth As Double
Dim NewHeight As Double
Dim ShrinkPercent As Double
Dim myCallback As GetThumbnailImageAbort
myCallback = New GetThumbnailImageAbort(AddressOf ThumbnailCallback)
If bmp.Width > bmp.Height Then
NewWidth = NewSize
ShrinkPercent = (NewWidth / bmp.Width) * 100
NewHeight = (ShrinkPercent / 100) * bmp.Height
Else
NewHeight = NewSize
ShrinkPercent = (NewHeight / bmp.Height) * 100
NewWidth = (ShrinkPercent / 100) * bmp.Width
End If
Dim myShrunkenImage As Image = bmp.GetThumbnailImage(NewWidth,
NewHeight, myCallback, IntPtr.Zero)
Return myShrunkenImage
End Function
Public Function ThumbnailCallback() As Boolean
Return False
End Function
'--
'William Kahler
'.NET Developer, MCSD