Question : Crop Images

In my attached code I am resizing the images and uploading them.

This gives a set width and the height is whatever...

Is there a way to:
1. Resize the image so that either the max width  is 624
AND the max height is 420>

OR

2. Set the max width at 624 and crop the height.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
----Partial code---
Blah...blah...blah...
 Dim imagefile As UploadedFile = FileUpload.UploadedFiles(0)
            Dim MyImage As New Bitmap(imagefile.InputStream)

            '********Resize Image ********
            Dim Img As Bitmap = New System.Drawing.Bitmap(imagefile.InputStream)
            ResizePhotos(imagefile, Img, 628, "", "large")
            '********End Resize Image **********

            If Not IsNothing(FileUpload.UploadedFiles(0)) Then
                If FileUpload.UploadedFiles(0).FileName.Length > 0 Then
                    Dim filepath As String = Path.Combine(Server.MapPath("") & "\Images", Path.GetFileName(FileUpload.UploadedFiles(0).FileName))
                    Dim filename = imagefile.GetNameWithoutExtension()
                    filename = filename & "_" & Request.QueryString("id")
                    filename = filename & imagefile.GetExtension()


Blah...blah...blah...

Answer : Crop Images

Random Solutions  
 
programming4us programming4us