Hej jeg fandt en stump code (se nedenfor), har lavet den om til en funktion der modtager 'sScale', som er aspect ratio. Og dit Image.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ImgReSize(txtScale.Text, PictureBox1.Image)
End Sub
Public Function ImgReSize(ByVal sScale As String, ByVal YoureImage As Image) As Image
'Fundet sampel på.
http://www.vb-helper.com/howto_net_image_resize.html ' Get the scale factor.
Dim scale_factor As Single = Single.Parse(sScale)
' Get the source bitmap.
Dim bm_source As New Bitmap(YoureImage)
' Make a bitmap for the result.
Dim bm_dest As New Bitmap( _
CInt(bm_source.Width * scale_factor), _
CInt(bm_source.Height * scale_factor))
' Make a Graphics object for the result Bitmap.
Dim gr_dest As Graphics = Graphics.FromImage(bm_dest)
' Copy the source image into the destination bitmap.
gr_dest.DrawImage(bm_source, 0, 0, _
bm_dest.Width + 1, _
bm_dest.Height + 1)
' Display the result.
Return bm_dest
End Function