On Tue, 30 May 2006 19:33:20 -0500, Paul <pa*********@gmail.com> wrote:
Hi all,
I've been using ASPImage and it frequently causes IIS to crash. Do any
of you have a good alternative to suggest?
I need something to handle resizing and cropping.
ImageMagick includes a COM object that may be suitable. The COM object
itself isn't particularly well-documented, but most of the functionality
it offers can be gleaned from the documentation for the command line
tools. I have included at the end of this article an example that will
create 64x64 thumbnails of all the images in the current directory.
http://www.imagemagick.org/script/index.php
Example follows:
Option Explicit
' = Function: Resize =
' Use an instance of the ImageMagickObject to change the dimensions of
' an image, preserving its aspect ratio.
'
' Arguments:
' im - An instance of the ImageMagickObject.
' src - The name of the source file.
' dst - The name of the destination file.
' width - The desired maximum width
' height - The desired maximum height
Function Resize(im, src, dst, width, height)
Dim msgs
msgs = im.Convert(src, "-resize", width & "x" & height, dst)
End Function
' = Function: Main =
' The entry point for the script.
'
' Returns:
' The script exit code
Function Main()
Dim im, fso, wd, file
Set im = CreateObject("ImageMagickObject.MagickImage.1")
Set fso = CreateObject("Scripting.FileSystemObject")
Set wd = fso.GetFolder(".")
For Each file In wd.Files
On Error Resume Next
Resize im, file.Name, "thumb_" & file.Name, 64, 64
On Error Goto 0
Next
Main = 0
End Function
WScript.Quit Main()
--
Justin Piper
Bizco Technologies
http://www.bizco.com/