Hi Mike,

I use this:

Private Sub Reduce(ByVal size As Integer)

    Dim newWidth As Interger = 0
    Dim newHeight As Interger = 0

    If img.Width > img.Height Then
         newWidth = size
         newHeight = size * img.Height / img.Width
    Else
         newHeight = size
         newWidth = size * imageToSize.Width / imageToSize.Height
    End If

    img = New Bitmap(img, New Size(newWidth, newHeight))
    picPhoto.Image = img

    Dim SizeKb As String
    ' To compute: size in Kb
    Dim ms As New MemoryStream()
    img.Save(ms, Imaging.ImageFormat.Jpeg)
    SizeKb = (ms.Length \ 1024).ToString() & "Kb "

    lblCurrentSize.Text = "Current Size: " & SizeKb & "(" & img.Width
& "x" & img.Height & ") [" & img.Width / img.Height & "]"
  End Sub

My VB is a bit rusty, but this is how I make the size conversions.

Hope it helps,  Mark

>From: Mike Appenzellar <[EMAIL PROTECTED]>
>Reply-To: [email protected]
>To: [email protected]
>Subject: [AspNetAnyQuestionIsOk] resize image with (vb) without using 
>factor
>Date: Thu, 11 Aug 2005 16:09:29 -0400
>
>I can do the following using factor but I don't want to resize the
>images by percent. I woudl like to set a size of say 120 and it would
>make it either 120 wide or 120 tall depending on its
>horizontal/vertical status.....any help would be great.
>
>  Private Sub Reduce(ByVal factor As Double)
>     img = New Bitmap(img, New Size(img.Size.Width * factor,
>img.Size.Height * factor))
>     picPhoto.Image = img
>
>     Dim SizeKb As String
>     ' To compute: size in Kb
>     Dim ms As New MemoryStream()
>     img.Save(ms, Imaging.ImageFormat.Jpeg)
>     SizeKb = (ms.Length \ 1024).ToString() & "Kb "
>
>     lblCurrentSize.Text = "Current Size: " & SizeKb & "(" & img.Width
>& "x" & img.Height & ") [" & img.Width / img.Height & "]"
>   End Sub
>
>
>
>
>Yahoo! Groups Links
>
>
>
>
>
>




------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12hlsdhj9/M=362329.6886308.7839368.1510227/D=groups/S=1705006764:TM/Y=YAHOO/EXP=1123824580/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992
">Fair play? Video games influencing politics. Click and talk back!</a>.</font>
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to