Thread: Image resizing
View Single Post
  #1 (permalink)  
Old 06-30-2009, 10:53 AM
davco davco is offline
VB.NET Forum Newbie
.NET Framework: .NET 1.1 (VS 2003)
 
Join Date: Sep 2006
Posts: 8
Reputation: 0
davco is on a distinguished programming path ahead
Smile Image resizing

I have an image resizing app and I need to keep the deminsions proportionate.
How do I do that with this code?


Private Sub Reduce(ByVal factor As Double)
img = New Bitmap(img, New Size(50, 50))
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
It resizes images well but doesn`t kep the width and height proportionate.
Reply With Quote