AutoImageSize Version 2.5

Component Reference

IMPORTANT: AutoImageSize version 2.5 is incompatible with all previous versions or AutoImageSize.  We strongly suggest installing and testing AIS 2.5 on a staging server prior to production deployment in order to determine if you will be impacted by these changes.  Be sure to read the following before upgrading from version 2.3.

Support

If you have any issues installing AutoImageSize, please let us know.  You can contact us via email at support@unitedbinary.com.

If you need to download the latest version of AutoImageSize, you can obtain it from our server.

To purchase AutoImageSize, visit our online store.

Standard Installation

  1. Run the installation program.  This will extract the COM component, the .NET wrapper, this documentation, and the sample code.  By default, this content will be placed in C:\Program Files\United Binary\AutoImageSize.
  2. Create a cache directory for your web site.  For simplicity's sake, create a directory directly below the physical web site root directory and name it "ImageResizeCache".  For example, if you were using the default IIS web root located in C:\InetPub\wwwroot, then this cache directory would be named C:\InetPub\wwwroot\ImageResizeCache.  Once you have everything working, you can move this directory somewhere else on the file system, but be sure to tell the component that you moved the physical and/or virtual directories by changing the CacheDir and CacheWebPath properties accordingly.
  3. Ensure that the proper NTFS security settings are applied to the cache directory.  Using the above step as a guide, if your cache directory is located at C:\InetPub\wwwroot\ImageResizeCache, right click that directory in Windows Explorer, click Properties and select the Security tab.  Add your web server's anonymous account, IUSR_MACHINENAME, to the list of users that have access to that directory and grant the account Read and Write access.  Please note that the MACHINENAME part of the account name will match the name of the web server -- so if your server is named SERVER6, then the full account name will be IUSR_SERVER6.
  4. Open the Internet Services Manager and grant the cache directory Read and Write access.  Open your web site root folder, find the ImageResizeCache virtual directory and right click it.  Click Properties, select the Directory tab and check the Read and Write check boxes.  Click OK when finished.  At this point, you should be able to take the ASP sample files, put them into your web site's root directory and run the ASP demo.
  5. For ASP.NET users: After performing the above steps on your web server, copy the contents of the "NET Assembly" directory into your web site's bin directory.  Next, reference the UnitedBinary.AIS assembly in your web application project.  At this point, you should be able to take the ASP.NET sample files, put them into your web application's root directory, and run the ASP.NET demo.
  6. If you are upgrading your AutoImageSize installation be sure to restart IIS.

Manual Installation

AutoImageSize can be manually installed using the ZIP file located in the "Redistributable" directory.  Copy the ZIP file to the target server, perform steps 2 - 4 of the Standard Installation section above, and then manually extract the contents of the ZIP file to a location on the server's hard drive.  Next, open a command prompt and change directory to the "COM Component" directory.  Manually register the COM component by running the command regsvr32 ais.dll from the command line.  If you are running ASP.NET, copy the contents of the "NET Assembly" directory into your web site's bin directory and reference the UnitedBinary.AIS assembly in your web application.

 

Component Properties

AspectRatioGuide

Gets or sets the aspect ratio guide used for resizing an image.

object.AspectRatioGuide [= guideNumber]

Arguments

object
Required.  Always the name of an AutoImageSize object.
guideNumber
Optional.  If provided, guideNumber is the new guide to use for subsequent resize operations performed by object.

Settings

The guideNumber argument can be set to any one of the following values:

ValueSymbolic ConstantDescription
0 aisNone Images will be resized to the exact dimensions specified in the call to the ChangeImageSize method.
1 aisAlbum Default.  This setting is a convenience guide for use with photo albums where images could either by oriented horizontally (landscape) or vertically (portrait).  This guide considers the width and height parameters specified in the call to the ChangeImageSize method to define the maximum dimensions of the resulting image regardless of image orientation.  For instance, if this guide was set and you were to call ChangeImageSize(fileName, 400, 300), then the image specified by fileName would be resized as follows:
  • If the image is wider than it is tall, the image will be resized with respect to its width.  This means the image will be no wider than 400 pixels.  Image height may vary, but it, too, will be no taller than 300 pixels.
  • If the image is taller than it is wide, then the image will be resized with respect to its height.  This means that the image will be no taller than 400 pixels.  The image width may vary, but it will be no wider than 300 pixels.
2 aisWidth Images will be resized with respect to the source image's width. Any height value specified in the call to the ChangeImageSize method will be ignored.
3 aisHeight Images will be resized with respect to the source image's height. Any width value specified in the call to the ChangeImageSize method will be ignored.
CacheDir

Gets or sets the physical directory in which cached images will be stored.

object.CacheDir [= directory]

Arguments

object
Required.  Always the name of an AutoImageSize object.
directory
Optional.  If provided, directory is the new physical path that object will use for creation and retrieval of cached images.
CacheWebPath

Gets or sets the virtual directory which will be prepended to the processed image filename.

object.CacheWebPath [= directory]

Arguments

object
Required.  Always the name of an AutoImageSize object.
directory
Optional.  If provided, directory is the new virtual path that object will prepend to the image created during a call to ChangeImageSize.  By default, this property is set to "/ImageResizeCache/".
JPGQuality

Gets or sets the output quality of the images produced during resize operations.

object.JPGQuality [= quality]

Arguments

object
Required.  Always the name of an AutoImageSize object.
quality
Optional.  If provided, quality specifies how the image produced during a call to ChangeImageSize will look.  Lower values reflect lower source image fidelity and smaller file sizes while higher values reflect better image fidelity and larger files.  Allowed values are between 1 and 100 inclusive.  By default, this property is set to 85.
RegCode

Sets the registration code for the component.  This property and the RegName property must be set to allow registered operation.  This property is write-only.

object.RegCode = registrationCode

Arguments

object
Required.  Always the name of an AutoImageSize object.
registrationCode
Required.  Set this argument to the value of the registration code you received when you purchased AutoImageSize.  Be sure to set this value before resizing any images otherwise the component will be operating in unregistered mode.  Alternatively, this property can be set globally by using the AutoImageSize settings application which can be launched from the Start menu.
RegName Sets the registration name for the component.  This property and the RegCode property must be set to allow registered operation.  This property is write-only.

object.RegName = registeredName

Arguments

object
Required.  Always the name of an AutoImageSize object.
registeredName
Required.  Set this argument to the value of the registered name you specified when you purchased AutoImageSize.  Be sure to set this value before resizing any images otherwise the component will be operating in unregistered mode.  Alternatively, this property can be set globally by using the AutoImageSize settings application which can be launched from the Start menu.
ResizeFilter Gets or sets the resampling filter used when resizing an image.
object.ResizeFilter [= filterNumber]

Arguments

object
Required.  Always the name of an AutoImageSize object.
filterNumber
Optional.  If provided, filterNumber specifies which resampling filter will be used to transform the source image during a call to ChangeImageSize.  The table below contains all valid filter numbers.  Please note that the Notes field is based upon our experience resizing average images such as digital photographs and scanned pictures.  That said, each filter performs differently based upon the data that the filter is processing, so that can mean that -- depending upon the image being processed -- our remarks may not apply.  If the results from the filter you are using are not to your liking, try using another filter.

Settings

The filterNumber argument can be set to any one of the following values:

ValueSymbolic ConstantNotes
0aisBoxFast, good quality filter for enlarging images.  This filter is not meant for reducing images due to the visual artifacts that occur.
1aisTriangleFast, good quality filter for enlarging images, but not as good as aisBox  This filter is not meant for reducing images due to the visual artifacts that occur.
2aisHammingThis filter produces heavy artifacts, but can be useful for enhancing image detail and brightness in some circumstances.
3aisGaussianThis filter is very lossy; can be used to heavily blur the source image.
4aisBellFast filter, decent for enlarging and reducing images, but image quality is fairly poor (although the degradation is not very noticeable when images are resized drastically).
5aisBSplineLike aisBell except it is lower quality.  Can be used to moderately blur the source image.
6aisCubic1Good quality filter.  Excels at enlarging and reducing images.  Good speed.
7aisCubic2Decent quality filter.  Average at enlarging and reducing images.  Good speed.
8aisLanczos3Default.  For most applications, this filter produces the best images in the most reasonable time.  Additionally, it exhibits no visible artifacts for any resizing ratio.  We recommend using this filter if most of your image requests will be cache hits (i.e., the first request generates the image and all subsequent user requests retrieve the cached image; usually the case when you offer only a certain number of available predefined image sizes).
9aisMitchellComparable to aisCubic1.
10aisSincNot particularly suited for reducing or enlarging images, but when used to reduce or enlarge an image by only a few pixels this filter can bring out image detail at the cost of color fidelity.
11aisHermitePrimarily suited to enlarging images.  Quick and accurate filter with good color fidelity with quality comparable to aisCubic1. Artifacting can occur when the resized image size is close to the source image size so make sure that the resized image dimensions are sufficiently different than the source image dimensions.
12aisHanningThis filter and aisHermite are very similar in quality.  It is mainly a matter of taste as to which you prefer.  This filter exhibits the same tendency to produce artifacts when source and resized image sizes are similar.
13aisCatromGood quality filter, similar to aisBicubic. Good all-around filter with some degradation when image size is reduced drastically.
14aisBicubicFast processing; above-average quality. Above-average filter for reducing and enlarging images.  This filter is one of the most popular industry-standard filters.
15aisSimpleExtremely fast filter, very poor quality, but can work well for certain images.
Statistics

Gets the processing statistics from the last resize operation.  This property is read-only.

object.Statistics
The object is always the name of an AutoImageSize object.

Component Methods

ChangeImageSize

Returns a string that specifies the location of a resized image within the image cache.  This value will consist of the CacheWebPath value followed by the resized image's filename.

object.ChangeImageSize(imagePath, width, height)

Arguments

object
Required.  Always the name of an AutoImageSize object.
imagePath
Required.  The physical path to the source image file.  The input image must be in one of the following formats: JPEG, TIFF, PNG, PSD, PCX, WMF, WBMP, or TGA.  Please note that there is NO support for GIF or TIFF images that use LZW compression.
width
Required.  The new image width.  This value may be ignored depending upon the setting of the AspectRatioGuide property.
height
Required.  The new image height.  This value may be ignored depending upon the setting of the AspectRatioGuide property.
SetPNGDefaultBackground

Sets a new default background color for transparent PNG images.

object.SetPNGDefaultBackground(paletteIndex, red, green, blue, gray)

Arguments

object
Required.  Always the name of an AutoImageSize object.
paletteIndex
Required.  If the PNG uses a color palette, this is the index of the color within the palette to use as the new background color.  If you set this value, set the remaining arguments to 0.
red
Required.  If the PNG does not use a color palette, this is the value of the red component of the new background color.  Valid values range from 0 to 255 inclusive.  If you set this value, set the paletteIndex and gray arguments to 0.
green
Required.  If the PNG does not use a color palette, this is the value of the green component of the new background color.  Valid values range from 0 to 255 inclusive.  If you set this value, set the paletteIndex and gray arguments to 0.
blue
Required.  If the PNG does not use a color palette, this is the value of the blue component of the new background color.  Valid values range from 0 to 255 inclusive.  If you set this value, set the paletteIndex and gray arguments to 0.
gray
Required.  If the PNG is grayscale, this specifies the shade of gray to use as the new background color.  Valid values range from 0 to 255 inclusive.  If you set this value, set all other arguments to 0.