Image manipulation in ASP

Components - Overpower DLL for image manipulation

The overpower DLL is not my work, but because I had such a hard time finding it anywhere I thought I'd mirror it on my site. The DLL is a component you can use from any programming envronment to manipulate images. The DLL can do a lot of things, but I use it mainly to resize images from ASP.
It is the only free image manipulation component I could find, and it is no longer supported by its author.
The component is written by a guy called Guba (gubah@sti.com.br), but I think his e-mail address might be outdated. You can download the entire package here, it has the DLL, some examples on how to use it and a helpfile explaining the details.

I noticed that there wasn't an example of how to create thumbnails, which is what most people do with such a component, so here's the ASP code I wrote to accomplish exactly that.
This creates thumbnails out of a directory of originals. It assumes you are looping the directory with the filesystemobject.

Dim ILIB set ILIB = server.createobject("Overpower.ImageLib") '*************************************************** '* Loop all files and retrieve the data * '*************************************************** ' This assumes you have a Folder object created with FileSystemObject For Each i in CurFiles ' Loop This If (InStr("JPG|GIF",Ucase(FSO.GetExtensionName(i)))) Then ' Make sure only the right filetypes filesize = i.Size ILIB.PictureSize i,width,height ' The values are now known, if the picture is landscape, ' the width of the thumbnail is 150 pixels maximum: If width > height Then ILIB.width = 150 ILIB.height = (height/width) * 150 ILIB.InsertPicture i ,0,0,true,150,(height/width) * 150 Else ' if the picture is portrait, ' the height of the thumbnail is 150 pixels maximum: ILIB.width = (width/height) * 150 ILIB.height = 150 ILIB.InsertPicture i ,0,0,true,(width/height)*150,150 End If ' You'll have to provide your own location to save the thumbnail. ' This is an example. thumbnail = Server.Mappath(Request.Form("DirectoryToIndex")&_ "thumbnails\thm_") & i.name ILIB.SavePicture thumbnail,3,80,0 Next

The component really works in kind of a weird way;
First you call the components "PictureSize" method, which puts the original imagewidth and height into the variables 'width' and 'height'
After that you can use 'width' and 'height' to determine the format of the picture, I use these two values to determine if the picture is oriented horizontally (landscape) or vertically (portrait).
To create the thumbnail you'll have to set the width and height of a new "canvas" (ILIB.width=..., ILIB.height=...)
The last step is to insert the original picture onto the created canvas (ILIB.InsertPicture), thereby resizing it to thumbnail-size.