CFX_StampImage

July 18 2002

v1.0


© CS Internétique, Claude Schnéegans

DESCRIPTION

can be used to stamp a small image into a larger image, for instance some copyright notice or logo into a photo.
Two images must be provided: the image to be treated and the stamp image. The first can be in JPEG or PNG format, the second in JPEG, PNG or GIF format. GIF format cannot be used for the image, but it can be used for the stamp image.
The output image is produced by merging the stamp image into it under a 50%/50% ratio. If the stamp file uses a transparent color, the corresponding pixels from the source image are preserved. For this purpose, GIF or PNG format must be used for the stamp image, since the JPEG format does not support transparent colors.

The format of the images are determined by the file extensions: .jpg, .jpeg, .gif or .png.

A typical situation, like in the example provided, would be to stamp a photograph with some copyright notice as it is received on the server. This stamp image can be simply embossed over a transparent background. The result will be a semi-transparent stamp over the image.

The image could be stamped as well off line before it is sent to the server, but the advantage of using this tag is that both the original for archive purpose, and the stamped image for display on the site, could be saved on the server.
NOTE

For any problem or suggestion, please contact the author of the tag.

INSTALLATION

To use this tag, you need to take the included ODBCInfo.dll, install it on a drive on your server and make it known to the ColdFusion administrator.

You do this by going to the "CFX Tags" tab in the administrator,

  1. click the "add" button.
  2. Specify the name as CFX_StampImage.
  3. For the Serverlibrary(dll), specify the path to the .dll (the directory into which you copied StampImage.dll.
  4. It should say for "Procedure", "ProcessTagRequest".
That's it!

For more information refer to the ColdFusion documentation "Managing CFXs".

Important Note:
This tag uses the following DLL which must be active on your system:

ADVAPI32.DLL
COMCTL32.DLL
COMDLG32.DLL
GDI32.DLL
KERNEL32.DLL
SHELL32.DLL
SHLWAPI.DLL
STAMPIMAGE.DLL
USER32.DLL
WINSPOOL.DRV

All these file are standard in Windows 98 and NT.

If one of these files is missing, you will probabily get the following error message message:

Error loading CFX custom tag library


The library associated with the custom tag CFX_STAMPIMAGE
(c:\coldfusion\bin\cftags\StampImage.dll) was not found.

Please check the LibraryPath entry for this tag in the custom tag database to
verify that the library file exists and is accessible by the ColdFusion
service.

SYNTAX
<CFX_StampImage
  IMAGEFILE   = ""
  STAMPFILE   = ""
  OUTFILE   = ""
  MERGEFACTOR   = ""
  X    = ""
  Y     = ""
  >

Example

<CFX_StampImage
  IMAGEFILE="#Expandpath('hockey.jpg')#"
  STAMPFILE="#Expandpath('stamp.gif')#"  
  OUTFILE="C:\temp\stamped.jpg"
  X="50"
  Y="50">

TAG ATTRIBUTE CONTENT REQUIRED DEFAULT
<CFX_StampImage IMAGEFILE= Full path of the input file image. Yes  
STAMPFILE= Full path of the input stamp file image. Yes  
OUTFILE= Full path of the output file image. Yes  
MERGEFACTOR= A percentage amount the stamp image will be merged into the input image. 100 means that the area in the input image is completely replaced by the stamp image (except for transparent pixels), while 0 means no action is taken. No 50
X= X coordinate where to merge the stamp image into the input image. Yes  
Y= Y coordinate where to merge the stamp image into the input image. Yes  

See an example here

See other cool tags by
See other cool tags