ActiveImage v 4.11 - ActiveX component to create PNG and Jpeg images on the fly.

Active Image is ActiveX component to create PNG and Jpeg images on the fly. The distribution package includes full source code and documentation. Active Image works with several images simultaneously, copies subimages with linear image transformations, reads and saves images to databases, files and calling program variables, supports direct output to browser data streams and much more. The methods like geometric primitive drawing, image information, shape drawing, bars, charts, pixel manipulation, text output with selectable fonts and angles are all included.

Platform: Windows 95/98/NT/2000.

The component can be used in all programs that can call ActiveX components. It includes ASP, IIS, MS Word, Access, Excel and many others.

The downloadable distribution package includes:

  • ActiveImage MS Visual C++/MFC project with full source code.
  • Documentation
  • Patch for gd_ss.h include file.
  • Samples for each function
  • MS Access Database.
  • Compiled binary ActiveImage.dll component (located in ActiveImage/ReleaseMinSize directory)

You can purchase and download the component for $29.95 via RegSoft here. To order by phone, call (877)-REGSOFT and tell the product ID: 38207.

Features:

  • Full support of PNG and Jpeg image formats
  • Full source code and installation instructions
  • Simultenios work with several images
  • Line, pixel and rectangle drawing (see full list below)
  • Text output with selectable font, font styles and angle
  • Polygon and filled polygon drawing
  • Reading/Saving images from/to databases like MS SQL sever and MS Access
  • Saving/Reading images to/from files
  • Saving/Reading images to/from variables of calling program
  • Direct image output to browser data stream
  • Setting/Retrieving image information
  • Pie charts drawing
  • Error catching

Quick start instruction to use ActiveImage component

  • Register ActiveImage component on your computer (it's not necessary to have a server). Run Start->Run dialog and type "path_to_regsvr\regsvr32.exe path_to_activeimage\ActiveImage.dll". Make sure you specify correct paths. For example, "C:\windows\regsvr32.exe C:\ActiveImage\ActiveImage.dll". You should see "ActiveImage DLL registered successfully" message.
  • Open MS Access "tonec.mdb" database from distribution package if you have MS Access.
  • Open "Testing" form and click "test" button. You can verify that newly created image showing your current time has appeared (the file with the image named test.jpg will be created in the root of drive C).

tonecdb.gif
Picture 1

Quick start instruction for ASP developers

  • Create a web-site or virtual directory
  • Register ActiveImage component on your computer (it's necessary to have a Web server like IIS or PWS). Go to menu "Start", choose "Command Prompt" and change the directory to where ActiveImage component is located. Run from command line "regsvr32 ActiveImage.dll". You should see "ActiveImage DLL registered successfully" message.
  • If you have problem with registration, try to specify path before regsvr32.exe and ActiveImage component. For example, "C:\windows\regsvr32.exe C:\ActiveImage\ActiveImage.dll"
  • Place "diagram.asp" from distribution package to your virtual directory.
  • Open corresponding url from your browser.

Sample 1. Drawing pie charts and text lines of different fonts.
Diagram.vbs


Dim im
dim dat1,r1,g1,b1
Set im = CreateObject("ActiveImage.Images.1")

im.CreateImage 300,300

im.SetColor 0,255,0
im.Fill 299,299

dat = "20,45,15,9,11"
r = "255,255 ,255,0 ,0 "
g = "0 ,0,255,255 ,0"
b = "0 ,255,127,255,255"

dat1 = split(dat,",")
r1 = split(r,",")
g1 = split(g,",")
b1 = split(b,",")
x = 0

For i = 0 to 4
im.SetColor r1(i),g1(i),b1(i)
im.DrawFilledArc 150,150,160,160,(x*3.6),(dat1(i)+x)*3.6
x = x + dat1(i)
next

im.SetFont 4
im.SetColor 0,0,0
im.DrawText 20,20 , "HTTP://WWW.TONEC.COM/"
im.SetFont 0
im.SetColor 0,0,0
im.DrawText 20,40 , "HTTP://WWW.TONEC.COM/"

im.WriteToFile "C:\diagram.png"

im.SetImageType 1
im.SetJpegQuality 100
im.WriteToFile "C:\diagram.jpg"
im.DestroyImage
Set im = Nothing


diagram.jpg diagram.png
Picture 2. diagram.jpg (size - 29 Kb) Picture 3. diagram.png (size - 3 Kb)

Sample 2. Read from file and save to a database
Database.vbs


Dim im, rs

Set im = CreateObject("ActiveImage.Images.1")

im.ReadFromFile "C:\diagram.png"

Set rs = CreateObject("adodb.recordset")
dsn = "tonec"
rs.Open "pictures", dsn, 2, 3
rs.AddNew
im.WriteToDatabase rs.Fields("Bitmap")
rs.Update
rs.Close
im.DestroyImage
Set im = nothing

Sample 3 . Single image manipulation: read image from file, find canvas dimensions, copy the part of image with linear transformations and save to Jpeg file with lowest quality.
Rose.vbs


Dim im, rs
Set im = CreateObject("ActiveImage.Images.1")
im.SetImageType 1
im.ReadFromFile "C:\rose.jpg"
h = im.GetHeight
w = im.GetWidth


im.SetImage 1
im.CreateImage w/2,h/2
im.CopyImageResize 1,0,0,0,0,0,w/2,h/2,w,h
im.SetJpegQuality 25
im.WriteToFile "C:\copyrose.jpg"
im.DestroyImage
im.SetImage 0
im.DestroyImage

Set im = Nothing



rose.jpg copyrose.jpg
Picture 4. rose.jpg (size - 6 Kb) Picture 5. copyrose.jpg (size - 1.6 Kb)


Implemented Methods:

Method Description
CopyImage Copy image part
CopyImageResize Copy image part with resize
CreateImage Create image
DestroyImage Destroy image and clean up the memory
DrawArc Draw Arc
DrawEllipse Draw Ellipse
DrawFilledArc Draw filled arc (can be used to create pie charts)
DrawFilledEllipse Draw filled ellipse (can be used to create charts)
DrawFilledPolygon Draw filled polygon
DrawFilledRectangle Draw filled rectangle
DrawLine Draw line
DrawPolygon Draw polygon
DrawRectangle Draw rectangle
DrawText Draw text
DrawTextAngle Draw text with angle
Fill Color fill (changing color for another color)
GetColorBlue Get blue value of current color
GetColorGreen Get green value of current color
GetColorRed Get red value of current color
GetFont Get font for text output operations
GetHeight Get image height
GetImage Get image handle
GetImageType Get image format (PNG, Jpeg)
GetInterlace returns true if image is interlaced
GetJpegQuality Get Jpeg quality value
GetLineThickness Get current line thickness (used in DrawLine, etc)
GetPixelBlue Get blue value for a pixel
GetPixelGreen Get green value for a pixel
GetPixelRed Get red value for a pixel
GetTransparent Returns current transparent color
GetWidth Get image width
ReadFromDatabase Read image from database
ReadFromFile Read image from file
ReadFromVariable Read image from variable
SetColor Set foreground color
SetFont Select current font
SetImage Select active image
SetImageType Set image format (PNG, Jpeg)
SetJpegQuality Set Jpeg quality value
SetLineThickness Set line thickness for simple draw operations
SetPixel Set pixel
SetTransparent Set transparent color
WriteToDatabase Write image to database
WriteToFile Write image to file
WriteToVariable Write image to variable (can be also used to write image directly to browser data stream)


Source code compilation instructions (not needed for most users)

If you want to build the component from the source code:

  • Install all needed libraries (for more information, take a look at T1CFreeImage)
  • If you already installed free T1CfreeImage component, you need to place ActiveImage directory in the same place where gd, zlib, libpng and libjpeg directories are located.
  • Add lines to gd_ss.c file of GD library. (Changed file is included in gd directory of the distribution)
  • Change the following line in stdaxf.h
    // Include ADO Interface/Class Descriptions (ADO 1.5 Version) #import "c:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename( "EOF", "adoEOF" )
    if "msado15.dll" is located in different directory.
  • Build project
  • Sample 3 "Copying image" needs file "C:\rose.jpg".
  • Sample 2 "Writing image to database". Create DSN "tonec" that will point to MS Access "tonec.mdb".


Note that Tonec Inc. also provides custom programming and cost-effective offshore software development services. Check out our Free Products page.

If you have any questions or bug reports, write to active.image@tonec.com for technical support.