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("Persi ts.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
To see what I need look here: http://technikcorp.com/crop.jpg
And here is my code:
==========================
Set Jpeg = Server.CreateObject("Persi
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Note, I switched out the height and width in the if statement. And removed Jpeg.Quality as my version didn't support that.
ASKER
Perfect. Thanks!
NP! Glad to help!