AutoImageEffects Documentation
Version 1.5

A Product of United Binary, LLC.
http://www.unitedbinary.com
support@unitedbinary.com

AutoImageEffects is a web server component (COM and .NET) which performs image processing in Active Server Pages (asp) or the ASP.NET framework. Both the .NET and COM components behave the same so this documentation, besides actual source code, will apply to both.

Documentation Sections
Setup / Installation
Usage Limitations and Licensing
Methods and Properties
Using the Component
Sample Web Page
Version History


Setup / Installation
  1. Run the distributed install program. You probably have already done this because that is the program that installs this documentation. In addition, it will install and register the AutoImageEffects COM component. It will install a copy of the AutoImageEffects .NET component. But be careful, the .NET component needs to be placed in the bin directory of your web application (it is not globally registering like COM components). See the "Using the Component" section for more info.
  2. Give all virtual directories you want to save images to WRITE ACCESS. Do not save images to directories that do not have write access. This could potentially cause problems.

Usage Limitations and Licensing

By using AutoImageEffects you are agreeing to abide by these requirements and restrictions:

Proper usage:

AutoImageEffects may be used in any web environment. This can be ASP pages, ASP.NET pages, Cold Fusion pages, COM or .NET components built to extend AutoImageEffects functioning only in a web environment provided these components are designed for use by people who in addition own an AutoImageEffects license.

Improper usage:

AutoImageEffects may not be used to create components which encapsulate AutoImageEffects' functionality where these components are intended to be redistributed.

AutoImageEffects may not be used outside of a web environment. This is due to an agreement between the Smaller Animals Software Company and United Binary which allows us to use their graphics processing library in the limited scope of web page image processing. Otherwise, AutoImageEffects could be used to turn their hard work against them in the form of a competing product.


  Methods and Properties

AutoImageEffects uses a combination of properties () and methods () to achieve its functionality. Here is the current list of them grouped by functionality. All properties are read and write unless otherwise mentioned. The method / property types will be specified for the benefit of the .NET users. ASP 3.0 users can safely use variants (not that they have a choice).

File IO

filename (string) File name used for any operations involving file IO.
jpgQuality (int) JPEG quality, 1 = best compression, 100 = best image quality.
LoadFile(void) Load the file specified by the current filename.
SaveFile(void) Save the mage to the file specified by the current filename.

Image Information

imageWidth (int) [read only] Image width in pixels.
imageHeight (int) [read only] Image height in pixels.

Image Processing

blurLevel (int) Percentage of blurring to apply to the image.
Blur(void) Perform the blurLevel amount of blurring to the currently loaded image.

resizeFilter (int)

Filter to use when resizing (resampling) image. The available filter are listed below. The first 14 [0,1,2, ..., 13] filters give higher quality than the last two.  However, they take more time to perform the resampling.  The bicubic filter (14) is the default.

Value

Filter

0 Box
1 Triangle
2 Hamming
3 Gaussian
4 Bell
5 B-Spline
6 Cubic 1
7 Cubic 2
8 Lanczos 3
9 Mitchell
10 Sinc
11 Hermite
12 Hanning
13 Catrom
14 Bicubic [default]
15

Simple (linear)

aspectRatioGuide (int)

Aspect ratio guide to use when resizing image. The available guides are

Value

Aspect Ratio Guide

0 None
1 Auto [default]
2 Width
3 Height
Resize(int w, int h) Resizes the currently loaded image to w x h or the closest possible following the aspect ratio guide.

sharpenLevel (int) Percentage of sharpening to apply to the image.
Sharpen(void) Perform the sharpenLevel amount of sharpening to the currently loaded image.

autoBrightenLowThreshold (int) All pixels with equal or less color will be black.
autoBrightenHighThreshold (int) All pixels with greater than or equal color will be white.
AutoMagicallyBrighten(void) Automagically brighten the currently loaded image.

Despeckle(void) Despeckle the currently loaded image.

MedianCut(void) Median cut the currently loaded image.

FlipHorizonal(void) Horizontally flip the currently loaded image.
FlipVertical(void) Vertically flip the currently loaded image.
QuickRotate(int degrees) Rotate the currently loaded image either 90, 180, or 270 degrees.

  backgroundColorR (int) Red component of the background color.
 backgroundColorG (int) Green component of the background color.
  backgroundColorB (int) Blue component of the background color.
  edgeFadeRate (float) Specifies how the edges are created (default = 0.051).
  FadeEdges(void) Fade the edges of the currently loaded image to the background color.

Image Creation

  backgroundColorR (int) Red component of the background color.
 backgroundColorG (int) Green component of the background color.
  backgroundColorB (int) Blue component of the background color.
  CreateBlank(int w, int h) Create a new image of size w by h with the solid color using the background color.

Image Drawing

  fontColorR (int) Red component of the font color.
  fontColorG (int) Green component of the font color.
  fontColorB (int) Blue component of the font color.
  fontSize (int) Size of the font in pixels.
  font (string) Font face name (e.g. "Arial").
  textSmoothLevel (int) Anti-alias level. Values can be 1 = none, 2 = moderate, 4 = lots.
DrawText(string text, int x, int y) Draw a single line of text at the position (x,y). The above values will be used to determine how to draw the text.
DrawTextInRect(string text,
          int x0, int y0,
          int x1, int y1)
Draws the text formatted (word-wrapped) inside the rectangle (x0,y0,x1,y1). If the words do not fit horizontally, they may extend outside the rectangle slightly. If the text extends past the bottom of the rectangle, it will be truncated. The above values will be used to determine how to draw the text.

  backgroundColorR (int) Red component of the background color.
 backgroundColorG (int) Green component of the background color.
  backgroundColorB (int) Blue component of the background color.
  DrawRect(int x0, int y0, int x1, int y1) Draws a solid rectangle using the background color.

License Registration

  regName (string) [optional] Registration name given when you purchased the AIE. Set these before you call SaveImage().
 regCode (string) [optional] Registration code given when you purchased the AIE. Set these before you call SaveImage().


 Using the Component

Here is a series of minimal web pages using AutoImageEffects.


ASP 3.0 and VBScript

The following page creates an AutoImageEffects COM component. Then sets the filename, loads the image, automagically brightens the image using the default values, sets the output file name. Then saves the image and frees the memory taken by the object. Finally, it shows the result in the body of the page.

<%@ Language=VBScript %>
<%
   set fx = Server.CreateObject("UnitedBinary.AutoImageEffects")
   
   fx.regName = "Michael Kennedy"
   fx.regCode = "XXXXXXXXXXXXXXXXX"
   
   fx.filename = "C:\inetpub\wwwroot\software\images\1stamp.jpg"
   fx.LoadImage
   fx.AutoMagicallyBrighten
   fx.filename = "C:\inetpub\wwwroot\imagecache\stampout.jpg"
   fx.SaveImage
   
   set fx = nothing 
 %>
 <HTML>
    <HEAD>
       <META NAME="GENERATOR" Content="Microsoft Visual Studio 7.0">
    </HEAD>
    <BODY>
       <img src="/imagecache/stampout.jpg">
    </BODY>
 </HTML>
 

ASP.NET and C#

The following page creates an AutoImageEffects .NET component. Then sets the filename, loads the image, automagically brightens the image using the default values, sets the output file name. Then saves the image. Finally, it shows the result in the body of the page. The memory used by the object is freed via the .NET framework garbage collector. Note, the UnitedBinary.AIE.dll and Interop.IMGFXLib.dll DLLs must be in the web application's bin directory for this to work.

<%@ Language=C# %>
<%
   UnitedBinary.Imaging.AutoImageEffects aie = new UnitedBinary.Imaging.AutoImageEffects();
   aie.RegName = "Michael Kennedy";
   aie.RegCode = "XXXXXXXXXXXXXXXXX";
   aie.LoadImage(@"C:\inetpub\wwwroot\software\images\1stamp.jpg");
   aie.AutoMagicallyBrighten();
   aie.SaveImage(@"C:\inetpub\wwwroot\imageresizecache\stampout.jpg");
%>
<HTML>
   <HEAD>
      <META NAME="GENERATOR" Content="Microsoft Visual Studio 7.0">
   </HEAD>
   <BODY>
      <img src="/imageresizecache/stampout.jpg" >
   </BODY>
</HTML>


Sample Web Page

If you are interested in the source code involved in using the component, please see the previous section.

If you want to see a web page using AutoImageEffects in action, have a look at:

    http://www.unitedbinary.com/AutoImageEffects.aspx

and follow the "Interactive Demo Page" link.


Version History

10/16/2003
Version 1.5.2.1 
1. Fixed a second issue related to the bug #1 in the previous update.
2. Rebuilt COM component with Visual Studio.NET 2003 and ATL 7.1.
3. Updated the C# and ASP.NET sample code (above) to use the full .NET wrapper.

07/30/2003
Version 1.5.1.0
1. Fixed a critical, but uncommon bug where certain resampling filters used in conjunction with specific very small image sizes causes freeze-up when resizing images.
2. Updated the underlying ImgSource graphics library to version 2.2.20.0.

1/28/2002
Version 1.2
1. Added .NET Final Release MS.NET component, AIE now ships with Beta 2, Beta 2, RC1, and Final .NET components.
2. Updated underlying graphics library to version 2.1.15.1.

11/23/2001
Version 1.2
1. Fixed a problem which cause the image resizing filters to always use the default (bicubic) filter. Now setting the imageResizeFilter property will properly set the resizing filter as described in the help (this file).
2. Updated the underlying ImgSource graphics library to version 2.1.11.0.

10/01/2001
Version 1.1
1. Minor internal changes.
2. Updated the underlying ImgSource graphics library to version 2.1.9.8.
3. Added a RC1 compatible MS.NET component, AIE now ships with beta 1, beta 2, and RC1 .NET components.

06/23/2001
Version 1.0 
1. Added a Beta 2 compatible MS.NET component. AIE ships with a beta 1 and beta 2 component.
2. Updated the underlying ImgSource graphics library to version 2.1.7.0.

03/15/2001
Version 1.0 Initial Public Release