New Active Image v 4.2 - ActiveX component to create PNG and Jpeg images on the fly.

Active Image is an 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 images parts 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. Active Image also has methods for drawing of geometric primitives, shapes, bars and charts, getting image information, pixel manipulation, text output with selectable fonts and angles and many others.

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. Active Image is royalty-free for software and web site developers.

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 sample database.
  • Compiled binary ActiveImage.dll component (located in ActiveImage/ReleaseMinSize directory)

You can purchase and download the component for $49.95 via RegSoft secure forms here. To order by phone, call (877)-REGSOFT and tell the product ID: 38207. The demo version can be downloaded here.

Features:

  • Royalty-free for software and web site developers
  • Full support of PNG, Jpeg and WBMP image formats
  • Full source code and installation instructions
  • Simultaneous 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
  • Alpha Blending and the support for alpha channels
  • Support for true color and palletized images
  • Full support for True Type fonts
  • Pie charts drawing
  • Full error and exception handling

What's new in version 4.2 (released 17 Jan 2002)

  • Added WBMP format for cell phones and other WAP devices
  • Added Alpha blending
  • Added Transparency for palletized images
  • Added more methods for drawing text with true type fonts

Quick start instruction to use ActiveImage component

  • Register ActiveImage component on your computer (it's not necessary to have a web server). Open 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 installed.
  • 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)

New Since v4.2

ConvertToPalette Converts TrueColor image to palletized one
CreateImagePalette Creates Palette (256 color table)
DrawTextTTF Draws text with selected TrueType font
DrawTextAngleTTF Draws text with selected angle and TrueType font
GetColorAlpha Gets the alpha channel value of active foreground color
GetColorTotal Returns total number of colors used. Works only for palletized images
GetPixelAlpha Gets the value of alpha channel component of the color
GetTrueColor Returns true if image is in TrueColor
SetAlphaColor Sets color with alpha channel component. For palletized image any non-zero value will result in setting this color as transparent.
SetAlphaBlending Enables/Disables alpha blending
SetColorByIndex Sets color from already created color table (palette)
SetFontPathTTF Sets path to TrueType font directory
SetFontPathTTFAuto Sets path to TrueType font automatically
SetFontSizeTTF Sets true type font size
SetSaveAlpha Enables/Disables saving alpha channel color information


For more information you may take a look at the manual.

Source code compilation instructions (not needed for most users)

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

  • Install all required libraries (for more information, look at T1CFreeImage)
  • If you have 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. (The edited 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".

Download Active Image Trial here


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.