Getting Started
  Introduction
  What is ImgWriter?
  Features and Benefits
  Requirements
 
Quick Start
  Edit an Existing Image
  Create a New Image
  Save an Image in a Database
  The Image Collection Object

Programmer's Reference
  Object Model
      SAImageGen
          ImageGen
          Font
      SAImageCollection
          Images
          Image

Installation
  Installing ImgWriter

External Links
  ImgWriter home page
  Technical Support
  ImgWriter live demos
  SoftArtisans Home Page
  E-mail General Questions
  E-mail Technical Support

Object Model ImageGen Font Images Image


ImageGen

The ImageGen object generates images. ImageGen can create a new image (see CreateImage, CreateGradientImage, and CreateTwoWayGradientImage), or edit an existing image (see LoadImage). To create an instance of ImageGen, use

Set objImageGen = Server.CreateObject("softartisans.ImageGen")
ImageGen Methods
ImageGen Properties
ImageGen Methods
AddWatermark

Adds a watermark to the loaded image.

AddWatermark takes five parameters, but only the first is required:

WatermarkThe source of the watermark as a VARIANT. This parameter can be a file name, an ADO Recordset Field, or an array of bytes.
PositionThe position of the watermark in one of six sections on the original image as a SAWatermarkPosition enum. The default value is saiCenterLeft.
saiTopMiddle0
saiCenterMiddle1
saiBottomMiddle2
saiTopLeft3
saiCenterLeft4
saiBottomLeft5
saiTopRight6
saiCenterRight7
saiBottomRight8
OpacityLevel of opacity of the watermark as a double between 0 and 1. At 0, the watermark is completely transparent. At 1, it is completely opaque. The default value is 0.5.
TransitionColorThe color of the watermark as a long that will be made transparent when Opacity is set to a value less than 1. The default value is white (0xffffff).
ShrinkToFitA boolean value that determines whether the size of the watermark will reduced if it is greater than the size of the main image. The default value is true.

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	'--- Add the image in 'watermark.bmp' using all defaults
	objImageGen.AddWatermark "C:\temp\watermark.bmp"
	objImageGen.SaveImage saiBrowser, saiJPG, "c:\resize.jpg"
	
*NOTE: If you require greater control over the merging of the two images, the same effect can achieved with the method MergeWithImage.

Top
BlurImage

Blurs the generated image. BlurImage takes a value between 1 and 100. The image will be most blurred at 100.

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	objImageGen.LoadImage "c:\sample.jpg"
	objImageGen.BlurImage 100
	


Top
ChangeBrightness

Brightens the generated image. The higher the value of ChangeBrightness, the brighter the image.

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	objImageGen.LoadImage "c:\sample.jpg"
	objImageGen.ChangeBrightness 3
	


Top
CreateGradientImage

Creates a gradient two-color image.

Example:

CreateGradientImage takes five arguments:

WidthWidth of the generated image.
HeightHeight of the generated image.
BeginColorFirst of the two colors of the gradient image. When GradientDirection is saiHorizontal, BeginColor will start at the image's right border. When GradientDirection is saiVertical, BeginColor will start at the top of the image.
EndColorSecond of the two colors of the gradient image. When GradientDirection is saiHorizontal, EndColor will end at the image's left border. When GradientDirection is saiVertical, EndColor will end at the bottom of the image.
GradientDirection    Direction in which the image color will change from BeginColor to EndColor. Assign GradientDirection by name or number:
saiHorizontal0
saiVertical1

Example:

Set objImageGen = Server.CreateObject("softartisans.ImageGen")
objImageGen.CreateGradientImage 600, 200, _
		rgb(0,0,255), rgb(255,255,0), saiVertical
objImageGen.SaveImage saiBrowser, saiGIF, "c:\blueandyellow.gif"
	


Top
CreateImage

Generates a new image. CreateImage takes three arguments: Width, Height, and Color.

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	
	'--- Create a 500 X 500 white square
	objImageGen.CreateImage 500, 500, rgb(255,255,255)
	
	'--- Draw a blue ellipse on the image
	objImageGen.DrawEllipseOnImage 150, 200, 100, 50, true, rgb(0,0,255)
	
	'--- Save the new image as a gif file
	objImageGen.SaveImage saiBrowser, saiGIF, "c:\ellipse.gif"
	


Top
CreateThumbnail

Creates a thumbnail from the loaded image.

CreateThumbnail takes four parameters, but none are required:

WidthThe width, in pixels, of the thumbnail as a long.
HeightThe height, in pixels, of the thumbnail as a long. The default value is 150.
ResizeAlgorithm   Assign ResizeAlgorithm by name or number, to one of the following values. The default value is saiBilinear.
saiBilinear0The image will be resized using bi-linear interpolation, which is much faster than bi-cubic interpolation.
saiNearestNeighbor1The image will be resized using nearest-pixel resampling. This will work with colormapped images.
saiBicubic2The image will be resized using bi-cubic interpolation, which is much slower than bi-linear interpolation, but produces a slightly better result.
MaintainProportionsA boolean that determines whether the height to width proportions of the original will be maintained in the thumbnail. The default value is true.

Note: To ensure that an image will be a specific width and maintain the original ratio, set the Height parameter to 0. If the Height parameter is not set, ImageGen will apply the default value 200.

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	'--- Create a thumbnail, 200 pixels in height
	objImageGen.CreateThumbnail , 200
	objImageGen.SaveImage saiBrowser, saiJPG, "c:\resize.jpg"
	
*NOTE: If you require greater control over the resizing of an image, see the method ResizeImage.

Top
CreateTwoWayGradientImage

Creates a two-way, gradient, two-color image.

Example:

CreateTwoWayGradientImage takes five arguments:

WidthWidth of the generated image.
HeightHeight of the generated image.
BeginColorFirst of the two colors of the gradient image. When GradientDirection is saiHorizontal, BeginColor will start at the image's left and right borders. When GradientDirection is saiVertical, BeginColor will start at the top and bottom of the image.
EndColorCenter color of the gradient image.
GradientDirection    Direction in which the image color will change from BeginColor to EndColor. Assign GradientDirection by name or number:
saiHorizontal0
saiVertical1

Example:

Set objImageGen = Server.CreateObject("softartisans.ImageGen")
objImageGen.CreateTwoWayGradientImage 600, 300, rgb(0,0,255), _
		rgb(255,255,0), saiVertical
objImageGen.SaveImage saiBrowser, saiGIF, "c:\blueandyellow.gif"
	


Top
CropImage

Crops the generated image. CropImage takes four arguments:

LeftNumber of pixels to crop off the left side of the image.
TopNumber of pixels to crop off the top of the image.
WidthWidth of the cropped image.
Height   Height of the cropped image.

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	objImageGen.LoadImage "c:\sample.jpg"
	objImageGen.CropImage 50,30,150,100
	


Top
DrawEllipseOnImage

Draws an ellipse on an image. DrawEllipseOnImage takes six arguments:

XCenterThe distance of the ellipse's center from the image's left border
YCenterThe distance of the ellipse's center from the image's top border
HorizRadius   The horizontal radius of the ellipse
VertRadiusThe vertical radius of the ellipse
FillWhen Fill is set to True, the specified Color will fill the ellipse. When Fill is set to False, only the border of the ellipse will be colored.
ColorThe color of the entire ellipse or of its border, depending on the value of Fill.

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	objImageGen.CreateImage 500, 500, rgb(255,255,0)
	objImageGen.DrawEllipseOnImage 150, 250, 100, 50, True, rgb(0,0,255)
	objImageGen.SaveImage 2, saiJPG, "c:\ellipse.jpg"
	


Top
DrawLineOnImage

Draws an a line on an image. DrawLineOnImage takes five arguments:

StartX   Distance between the beginning of the line and the left border of the image
StartYDistance between the beginning of the line and the top border of the image
EndXDistance between the end of the line and the left border of the image
EndYDistance between the end of the line and the top border of the image
ColorThe color of the line

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	objImageGen.CreateImage 500, 500, rgb(255,255,0)
		
	'--- Draw a line from the top left corner of the image 
	'--- to its bottom right corner
	objImageGen.DrawLineOnImage 0, 0, 500, 500, rgb(0,0,255)
	


Top
DrawTextOnImage

Draws text on an image. DrawTextOnImage takes five arguments:

LeftDistance between the beginning of the text and the left border of the image.
TopDistance between the top of the text and the top border of the image.
WidthWidth of the area assigned for displaying text. If the length of the specified text exceeds Width, a truncated string will be displayed.
Height   Height of the area assigned for displaying text.
TextThe text to display on the image.

Use the Font object to define the look of text.

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	objImageGen.CreateImage 500, 500, rgb(255,255,0)
	objImage.DrawTextOnImage 50, 50, 100, 1, "Yellow Square"
	


Top
FillRectInImage

Draws a color-filled rectangle on an image. FillRectInImage takes five arguments:

LeftDistance, in pixels, between the left border of the rectangle and the left border of the image.
TopDistance, in pixels, between the top border of the rectangle and the top border of the image.
WidthThe width of the rectangle, in pixels.
Height   The height of the rectangle, in pixels.
ColorThe color of the rectangle.

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	
	'--- Create a yellow square image  
	objImageGen.CreateImage 500, 500, rgb(255,255,0)

	'--- Draw a white 100 X 50 rectangle on the yellow image
	objImageGen.FillRectInImage 50, 150, 100, 50, rgb(255,255,255)	
	


Top
FlipImage

Flips an image vertically or horizontally. Assign the flip direction by name or number:

saiFlipHorizontal   0
saiFlipVertical1

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	objImageGen.LoadImage "c:\sample.jpg"
	objImageGen.FlipImage saiFlipVertical	
	


Top
InvertImage

Inverts the image from negative to positive or positive to negative. This method has no parameters.

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	objImageGen.LoadImage "c:\sample.jpg"
	objImageGen.InvertImage
	


Top
LoadImage

Loads an existing image. Once the image is loaded, you can use ImageGen's methods and properties to edit it and save the new image. LoadImage can accept either a file or a byte array as an image source. Note: If you save the edited image with a new file name, you will not overwrite the original image.

Examples:

In the following example the image source is a file.

Set objImageGen = Server.CreateObject("softartisans.ImageGen")
objImageGen.LoadImage "c:\sample.jpg"	
objImageGen.FlipImage saiFlipHorizontal
objImageGen.SaveImage saiFile, saiGIF, "c:\sample.gif"	

In the following example the image source is a byte array. The image is retrieved from the image collection.

Dim byteArr
byteArr = objImages("Img3")
Set objImageGen = Server.CreateObject("softartisans.ImageGen")
objImageGen.LoadImage byteArr
Top
MergeWithImage

Merges a specified image with the loaded or created image. MergeWithImage takes five arguments:

XDistance, in pixels, between the left border of the main image, and the left border of the image to merge with the main image.
YDistance, in pixels, between the top border of the main image, and the top border of the image to merge with the main image.
ImageThe file path and name of the image to merge with the main image.
OpacityLevel of opacity as a value between 0 and 1. At 0, the merged image is completely transparent. At 1, it is completely opaque.
TransColorThe color of the top (merged) image that will be made transparent when Opacity is set to a value less than 1.

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	objImageGen.CreateImage 500, 500, rgb(255,0,0)
	objImageGen.MergeWithImage 50, 300, "c:\sample.jpg", 0.2, 1
	objImageGen.SaveImage saiFile, saiGIF, "c:\mergedimage.gif"
	


Top
ResizeImage

Resizes the image to specified width and height. ResizeImage takes four arguments:

WidthWidth, in pixels, of the resized image.
HeightHeight, in pixels, of the resized image.
ResizeAlgorithmOptional. Assign ResizeAlgorithm by name or number, according to the table below.Default value:
0
MaintainProportions   Optional. If set to 1, height to width proportions will be maintained after resizing. Default value:
1

Note: To ensure that an image will be a specific width and maintain the original ratio, set the Height parameter to 0. If the Height parameter is not set, ImageGen will apply the default value 200.

ResizeAlgorithm Values
saiBilinear0The image will be resized using bi-linear interpolation, which is much faster than bi-cubic interpolation.
saiNearestNeighbor1The image will be resized using nearest-pixel resampling. This will work with colormapped images.
saiBicubic2The image will be resized using bi-cubic interpolation, which is much slower than bi-linear interpolation, but produces a slightly better result.
saiFilterImage3This algorithm should only be used on continuous-tone images, such as, RGBA, RGB, and grayscale. Use this algorithm to preserve image quality when reducing an image. The algorithm will use the type of filter set by the ResizeFilter property.

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	objImageGen.LoadImage "c:\sample.jpg"
	objImageGen.ResizeImage 100, 200, saiNearestNeighbor, 0
	objImageGen.SaveImage saiFile, saiJPG, "c:\resize.jpg"	
	


Top
RotateImage

Rotates an image a specified number of degrees clockwise. RotateImage takes two arguments:

DegreesNumber of degrees to rotate the image.
BackColor   Color to display behind the rotated image.

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	objImageGen.CreateImage 100, 200, rgb(255,0,0)
	objImageGen.RotateImage 45, rgb(0,0,255)
	


Top
SaveImage

Saves the generated image. SaveImage takes three arguments:

SaveMethodSpecifies whether to stream the image to the browser, save it as a file, save it in memory, or save it as a database blob. Assign SaveMethod by name or number according to the table below.
ImageFormat   Specifies one of nine supported image file types. Assign ImageFormat by name or number according to the table below.
SaveDataSet SaveData to the complete file path and name for saving.

SaveMethod Values
saiFile0Save the image as a file.
saiMemory1Save the image in memory. If SaveMethod is set to saiMemory, SaveImage will return the byte array saved in memory.
saiBrowser2Stream the image to the browser.
saiDatabaseBlob   4      Save the image as a database blob.

ImageFormat Values
saiBMP1saiTIFF

Note: ImgWriter will not read a TIFF image with LZW compression.
6
saiGIF2saiWMF7
saiJPG3saiEMF8
saiPNG4saiPSD9
saiPCX5

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	objImageGen.LoadImage "c:\sample.jpg"
	objImageGen.FlipImage 1
	objImageGen.SaveImage 2, saiGIF, "sample.gif"


Top
SharpenImage

Sharpens the generated image. SharpenImage takes a value between 1 and 100. The image will be sharpest at 100.

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	objImageGen.LoadImage "c:\sample.jpg"
	objImageGen.SharpenImage 100
	


Top


ImageGen Properties
AntiAliasFactor

Anti-aliasing smoothes the jagged edges of diagonal lines and curves. When anti-aliasing is enabled, ImgWriter will test the color of sharp points on the edge of the image, calculate intermediate shades, and color the background area between sharp points with the appropriate intermediate shade. This blurs the colors along a curved or diagonal edge, making the edge appear smoother. Set AntiAliasFactor to an SAAntiAliasFactor value by name or number.

SAAntiAliasFactor Values:

saAntiAliasNone0
saAntiAliasGood2
saAntiAliasBest4
saAntiAliasHigh6
saAntiAliasHighest8

Higher AntiAliasFactor values require more memory and are therefore slower. SaAntiAliasBest (4) is the recommended value.

When anti-aliasing is not used, a text rectangle's dimensions are calculated based on the Top, Left, Height, and Width parameters passed to DrawTextOnImage (the text will be truncated if it exceeds the Width parameter value). When anti-aliasing is enabled, the Width and Height values of DrawTextOnImage are ignored and the dimensions of a text rectangle are determined by the font dimensions.

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	objImageGen.CreateImage 500, 500, rgb(255,255,0)
	objImageGen.DrawTextOnImage 50, 50, 100, 1, "Yellow Square"
	objImageGen.AntiAliasFactor = saAntiAliasBest
	


Top
BufferResponse

Use BufferResponse when streaming an image to the client to turn ASP response buffering on or off. By default, BufferResponse is set to False (off). When ASP buffering is off, the image is streamed to the browser using chunked transfer encoding.

Internet Explorer issue: IE cannot handle a refresh of a page that is sent using chunked transfer encoding (this is not an issue in Netscape). The BufferResponse property allows you to turn on buffering to enable refreshes in IE, at a cost of higher memory utilization on the server.

Top
ColorAdjustmentAlgorithm

Sets or returns an image color selection method as an enum of type SAIImageColorSelectMethod. This property determines how the image's RGB values will be mapped to the available color palette when saved. Set ColorAdjustmentAlgorithm by name or number, according to the following table.

saiQuantize0Creates an 8 bit image by performing color quantization and dithering on an RGB image.
saiNetscapeBestFit1Creates an 8 bit image by doing a best-fit (Euclidean distance) match of the pixels in the RGB to the values in the palette. Errors in color matching are ignored.
saiNetscapeBestFitDithered2Creates an 8 bit image by doing a best-fit (Euclidean distance) match of the pixels in the RGB to the values in the palette. Error in color matching are diffused by dithering.

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	objImageGen.LoadImage "c:\sample.jpg"	
	objImageGen.ColorAdjustmentAlgorithm = saiNetscapeBestFit
	objImageGen.SaveImage saiFile, saiGIF, "c:\sample.gif"
	

Top
ColorResolution

Sets the generated image's color resolution. Assign ColorResolution by name or number according to the following table.

saiGrayScale1
sai16Colors4
sai256Colors8
saiTrueColors24

Example:

	Set objImage = Server.CreateObject("softartisans.ImageGen")
	objImage.LoadImage "c:\sample.jpg"
	objImage.ColorResolution = saiGrayScale
	objImage.SaveImage 2, saiGIF, "c:\sample2.gif"
	


Top
DPIx

Sets or returns an image's horizontal DPI (Dots Per Inch). Depending on the value of the DPIunits property, DPIx will set/return dots per inch, centimeter, or meter.

Example:

Set objImage = Server.CreateObject("softartisans.ImageGen")
objImg.LoadImage "C:\image.jpg"
...
objImage.DPIx = 150
objImage.DPIy = 150
objImage.DPIUnits = saiDotsPerCm
...

Top

DPIy

Sets or returns an image's vertical DPI (Dots Per Inch). Depending on the value of the DPIunits property, DPIy will set/return dots per inch, centimeter, or meter.

Example:

Set objImage = Server.CreateObject("softartisans.ImageGen")
objImg.LoadImage "C:\image.jpg"
...
objImage.DPIx = 150
objImage.DPIy = 150
objImage.DPIUnits = saiDotsPerCm
...

Top

DPIunits

Sets or returns a unit for measuring DPI (Dots Per Inch). Use with the properties DPIx and DPIy. Set DPIunits by name or number:

DPIunits Values
saiDotsPerInch1Dots per inch
saiDotsPerCm2Dots per centimeter
saiDotsPerM3Dots per meter

Example:

Set objImage = Server.CreateObject("softartisans.ImageGen")
objImg.LoadImage "C:\image.jpg"
...
objImage.DPIx = 150
objImage.DPIy = 150
objImage.DPIUnits = saiDotsPerCm
...

Top

ErrorDescription

Returns an error description.

Example:

	On error resume next
	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	
	'--- Try to load an image that does not exist
	objImageGen.LoadImage Server.MapPath(Application("vroot") &_
		"samples/tutorial/images/flowers.gif")
	
	'--- Display an error description
	If objImageGen.ErrorDescription <> "" Then
		Response.Write objImageGen.ErrorDescription
	End If
	


Top
Font

Returns a Font object. Use the properties of Font to define the appearance of text on an image (see DrawTextOnImage).

Example:

	Set objImage = Server.CreateObject("softartisans.ImageGen")
	objImage.CreateImage 500, 500, rgb(255,255,204)
	Set objFont = objImage.font
	objFont.height = 50
	objFont.name = "verdana"
	objFont.color = rgb(221,0,0)
	objImageGen.DrawTextOnImage 50, 50, 300, 1, "Text"	
	


Top
Height

Returns the height of an image.

Example:

Set objImageGen = Server.CreateObject("softartisans.ImageGen")
objImageGen.LoadImage "D:\images\olivetrees.jpg"
objImageGen.ResizeImage (objImageGen.Width)*2, (objImageGen.Height)*2, _
				saiNearestNeighbor
	


Top
ImageFormat

Is a read-only property that returns the format of an image as an SAImageFormat enum type. SAImageFormat contains the following members:

saiBMP1saiTIFF6
saiGIF2saiWMF7
saiJPG3saiEMF8
saiPNG4saiPSD9
saiPCX5

Example:

Set objImageGen = Server.CreateObject("softartisans.ImageGen")
objImageGen.LoadImage "D:\images\olivetrees.jpg"
Dim imgFormat
imgFormat = objImageGen.ImageFormat
		


Top
ImageQuality

Sets or returns the quality of a jpeg image. ImageQuality is the inverse of compression. That is, the higher the value of ImageQuality, the larger the image data. ImageQuality may be any value between 1 and 100.

Example:

Set objImageGen = Server.CreateObject("softartisans.ImageGen")
objImageGen.LoadImage "D:\images\olivetrees.jpg"
objImageGen.ImageQuality = 100
objImageGen.SaveImage saiBrowser, saiJPG, "c:\images\olivetrees.jpg"


Top
JPEGProgressive

When set to True, the entire jpeg image will be rendered immediately in poor quality, and its quality will be progressively improved. When set to False, the jpeg image is rendered piece by piece, but at full quality. JPEGProgressive is set to True by default.

Example:

Set objImageGen = Server.CreateObject("softartisans.ImageGen")
objImageGen.LoadImage "D:\images\olivetrees.jpg"
objImageGen.JPEGProgressive = False
objImageGen.SaveImage saiBrowser, saiJPG, "c:\images\olivetrees.jpg"


Top
ResizeFilter

If you set the third parameter of ResizeImage to saiFilterImage, set ResizeFilter to the type of filter the resize algorithm should use.

Set ResizeFilter to a number from 0 to 13:

0box7cubic 2
1triangle8Lanczos 3
2Hamming9Mitchell
3Gaussian10sinc
4bell11Hermite
5B-spline12Hanning
6cubic 113Catrom
When reducing an image, the results acheived with each filter will depend on the original image. For most images, filter 0-3 will produce the highest quality reduced image.

ResizeFilter is a Read/Write property. The default value is 4.

Example:

	Set objImageGen = Server.CreateObject("softartisans.ImageGen")
	objImageGen.LoadImage "c:\sample.jpg"
	objImageGen.ResizeImage 100, 200, saiFilterImage, 0
	objImageGen.ResizeFilter = 2
	objImageGen.SaveImage saiFile, saiJPG, "c:\resize.jpg"
	


Top
Text

The string that will be added to the image when DrawTextOnImage is called.

Example:

Set objImageGen = Server.CreateObject("softartisans.ImageGen")
objImageGen.CreateImage 300, 50, rgb(0,255,255)
objImageGen.Font.Italic = True
objImageGen.Font.Height = 20
objImageGen.Text = "The current time is " & Time
objImageGen.DrawTextOnImage 10, 10, objImageGen.TextWidth, objImageGen.TextHeight
objImageGen.SaveImage saiBrowser, saiJPG, "C:\temp\time.jpg"
	


Top
TextHeight

Returns the height of the string passed as the one, optional parameter. If no parameter is specified, this property returns the height of the string that was previously set as the Text property.

Example:

Set objImageGen = Server.CreateObject("softartisans.ImageGen")
objImageGen.Font.Italic = True
objImageGen.Font.Height = 20
Dim nHeight, nWidth
objImageGen.Text = "The current time is " & Time
nHeight = objImageGen.TextHeight
nWidth = objImageGen.TextWidth
objImageGen.DrawTextOnImage 10, 10, nWidth, nHeight
objImageGen.SaveImage saiBrowser, saiJPG, "C:\temp\time.jpg"


Top
TextWidth

Returns the width of the string passed as the one, optional parameter. If no parameter is specified, this property returns the width of the string that was previously set as the Text property.

Example:

Set objImageGen = Server.CreateObject("softartisans.ImageGen")
objImageGen.Font.Italic = True
objImageGen.Font.Height = 20
Dim nHeight, nWidth, strTime
strTime = "The current time is " & Time
nHeight = objImageGen.TextHeight(strTime)
nWidth = objImageGen.TextWidth(strTime)
objImageGen.DrawTextOnImage 10, 10, nWidth, nHeight, strTime
objImageGen.SaveImage saiBrowser, saiJPG, "C:\temp\time.jpg"
	


Top
TiffPage

ImgWriter can read individual pages of a multi-page tiff file. When loading a multi-page tiff file, before calling LoadImage, set TiffPage to the desired page.

Tiff page numbers are 1-based.

TiffPage is a Read/Write property. The default value is 1.

Example:

Set objImageGen = Server.CreateObject("softartisans.ImageGen")
objImageGen.TiffPage = 5
objImageGen.LoadImage "c:\sample.tif"
	


Top
TransparentColor

This property can be used with gif images. TransparentColor will make a specified color transparent.

Example:

Set objImageGen = Server.CreateObject("softartisans.ImageGen")
'--- Create a 200*200 yellow square
objImageGen.CreateImage 200, 200, rgb(255,255,204)
'--- Draw a blue circle on the yellow square
objImageGen.DrawEllipseOnImage 100, 100, 50, 50, True, rgb(0,0,255)
'--- Make blue transparent
objImageGen.TransparentColor = rgb(0,0,255)
...


Top
Width

Returns the width of an image.

Example:

Set objImageGen = Server.CreateObject("softartisans.ImageGen")
objImageGen.LoadImage "D:\images\olivetrees.jpg"
objImageGen.ResizeImage (objImageGen.Width)*2, (objImageGen.Height)*2,_
					saiNearestNeighbor
	


Top


Object Model ImageGen Font Images Image


Copyright © 2001-2004, SoftArtisans, Inc.