Link to home
Start Free TrialLog in
Avatar of MarkWalker69
MarkWalker69

asked on

Create Cropped Thumbnail using ASPJPEG

I am using AspJpeg to create thumbnails for images. I need to preserve the aspect ratio and then crop the thumbnail image to fit in a 100 x 100 pixel area. I know how to create the thumbnail and resize it but the AspJpeg manual on cropping does not make sense to me.

To see what I need look here: http://technikcorp.com/crop.jpg

And here is my code:
==========================================================
         Set Jpeg = Server.CreateObject("Persits.Jpeg")
         ResizePath2 = vSitePath & vFolder &"\"& vMediaFile
         Jpeg.Open ResizePath2
                        Jpeg.PreserveAspectRatio = True
                        L = 100

                        If Jpeg.OriginalWidth > Jpeg.OriginalHeight Then
               Jpeg.Width = L
         Else
               Jpeg.Height = L
                        End If

                       Jpeg.Sharpen 1, 150
                       Jpeg.Quality 100
        Jpeg.Save vSitePath & vFolder &"\tn_"& vMediaFile

 
ASKER CERTIFIED SOLUTION
Avatar of L00M
L00M
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Note, I switched out the height and width in the if statement. And removed Jpeg.Quality as my version didn't support that.
Avatar of MarkWalker69
MarkWalker69

ASKER

Perfect. Thanks!
NP! Glad to help!