COM Component: AspIMAGE: Using AspImage on Your Website

About AspImage

ASPImage allows you to create images on the fly from ASP. Features include:

  • Create GIF* (RLE encoding only. Loading of GIFs not supported) JPG, PNG, BMP, TGA and PCX format images.
  • Modify existing images (JPG, BMP, PNG, TGA and PCX)
  • Gradient fills
  • Animated GIF creation
  • A large variety of draw methods
  • Transparent PNG and GIF

ASPImage Example Code

Using the component is as simple as:

  • Creating the object
  • Setting a few properties
  • Calling the SaveImage method

The following code demonstrates how to use ASPImage from VBScript. In this example we'll create a text image that say's "Welcome to" with a gradient fill.

Set Image = Server.CreateObject("AspImage.Image")
' Set various font parameters
Image.FontColor = vbBlack
Image.Italic = True
Image.Bold = True
Image.FontName = "Arial"
Image.FontSize = 12
Image.PadSize = 10
' Calculate how big our text info is and set the image to this size
' This has to be done since we want to fill the area with a gradient
strMessage = "Welcome to"
Image.MaxX = Image.TextWidth (strMessage)
Image.MaxY = Image.TextHeight (strMessage)
' Create a one way gradient
Image.GradientOneWay vbRed, vbWhite, 0
' Print our string to the image
Image.TextOut strMessage, Image.X, Image.Y, false
' Set the filename and save
Image.FileName = "msg1.jpg"
if Image.SaveImage then
Response.Write "<img src=""msg1.jpg"">"
Response.Write "Welcome to"
end if

By testing the result of the SaveImage method, you can determine if the image save was successful or not. If something happened that causes the image not to be saved it probably means the script is saving the image to an invalid directory or a directory where write rights do not exist.

GIF Animations

Images can be loaded or manipulated and then as these modifications occur you can save them to an animated sequence using the call AddImageToAnimation. A simple example of GIF animation can be found in soianim.asp which is included with the eval zip file for AspImage.

For full documentation and more examples of using AspImage, please visit

Add Feedback