ImageTranslate

Description

Copies an image to a new location on the plane.

Returns

Nothing.

Function syntax

ImageTranslate(name, xTrans, yTrans [, interpolation])

History

ColdFusion 8: Added this function.

Parameters

Parameter

Description

name

Required. The ColdFusion image on which this operation is performed.

xTrans

Required. Displacement in the x direction.

yTrans

Required. Displacement in the y direction.

interpolation

Optional. Type of interpolation used for resampling:

  • nearest: Applies the nearest neighbor method of interpolation. Image quality is lower than the other interpolation methods, but processing is fastest (default).

  • bilinear: Applies the bilinear method of interpolation. The quality of the image is less pixelated than the default, but processing is slower.

  • bicubic: Applies the bicubic method of interpolation. Generally, the quality of image is highest with this method and processing is slowest.

Usage

For each pixel (x, y) of the destination, the source value at the fractional subpixel position (x - xTrans, y - yTrans) is constructed with an interpolation object and written to the destination. If both xTrans and yTrans are integral, the operation wraps the source image to change the image’s position in the coordinate plane.

Use the ImageSetAntialiasing function to improve the quality of the rendered image.

Example

<!--- Create a ColdFusion image from an existing JPEG file. ---> 
<cfimage source="../cfdocs/images/artgallery/aiden01.jpg" name="myImage"> 
<!--- Turn on antialiasing to improve image quality. ---> 
<cfset ImageSetAntialiasing(myImage,"on")> 
<!--- Offset the image's position to (20,10). ---> 
<cfset ImageTranslate(myImage,20,10)> 
<!--- Display the offset image in a browser. ---> 
<cfimage source="#myImage#" action="writeToBrowser">