By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,423 Members | 2,466 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,423 IT Pros & Developers. It's quick & easy.

COM object for image processing in ASP

P: n/a
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.

Any suggestions would be much appreciated.

Thanks,

Paul

May 31 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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/
May 31 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.