DynImage Documentation

by Chris Ashton
June 2002
version 1.03


This ActiveX object enables ASP developers to create on-the-fly dynamic images for their website in PNG (Portable Network Graphics) format. I developed it for myself for one of my side projects, being unable to find a similar piece of software that did what I wanted and that WASN'T extortionately priced. Although probably obsoleted by ASP.Net, I still release it to the world at large, free of charge. Share and enjoy.

DynImage was created using libpng, which rocks, Microsoft Visual C++ 6.0, which somewhat rocks, and ATL, which most emphatically does not rock.

[New: Jan 29, 2003] -- some users reported that, on Windows 98, regsvr32 fails with the error message "DllRegisterServer in dynimage.dll failed. Return code was: 0x80070078". The problem was that earlier of DynImage and earlier were built for Unicode systems (NT, 2000, XP). This has now been fixed in version 1.03, which uses one-byte-char functions and should run on all systems.

Let me know if you encounter any problems with this control, and I'll get right to fixing it.

How To Use

To install, copy the DLL file dynimage.dll (111K) to your server and then run "regsvr32 dynimage.dll" from the command line. You're now ready to go!

In your ASP page, use the following code as a start:

Or, if you prefer JScript:

Reference

Colors

Colors are represented by 24-bit numbers. The high 8 bits are the red component; the middle 8 bits are the green component; and the low 8 bits are the blue component.

This is exactly the same way HTML names colors, so if you know what <FONT color="#FFCC33"> means, you can get the same color with the statement

Otherwise, you can use this formula to determine your color:

where red, green, and blue are integers between 0 and 255, inclusive.

Methods

Arc(x1, y1, x2, y2, x_start, y_start, x_end, y_end)

Close( )

Ellipse(x1, y1, x2, y2)

GetPixel(x1, y1) returns integer

ImageHeight(filename)

ImageWidth(filename)

Line(x1, y1, x2, y2)

LoadImage(x1, y1, [x2, y2,] filename)

Open(x, y)

Pie(x1, y1, x2, y2, x_start, y_start, x_end, y_end)

Rectangle(x1, y1, x2, y2)

SaveImage(filename)

SetPixel(x, y, color)

TextHeight(string)

TextOut(x, y, text)

TextWidth(string)

Properties

Color (integer)

FillColor (integer)

FontAngle (integer)

FontFace (text)

FontItalic (integer)

FontSize (integer)

FontUnderline (integer)

FontWeight (integer)

Image (byte array)

LineWidth (integer)

TextAlign (integer)

Transparent (integer)

Licensing + Contact Information

This software is beggarware. You can use it for free, but if you find this object useful, please help an out-of-work dotcom-era veteran with a $20 bill or whatever small change you can find in your pockets. Especially if you use it for commercial purposes. Source code is also available for the asking.

You can also send donations to cashton@oz.net via PayPal.

Standard disclaimers apply, esp. the bit about no warranty, expressed or implied, please don't use this for mission-critical, people-will-die-if-it-has-a-bug applications, etc, etc. You know the drill.