ImageFlip

Description

Flips an image across an axis.

Returns

Nothing.

Function syntax

ImageFlip(name [, transpose])

History

ColdFusion 8: Added this function.

Parameters

Parameter

Description

name

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

transpose

Optional. Transpose the image:

  • vertical: Flip an image across an imaginary horizontal line that runs through the center of the image (default).

  • horizontal: Flip an image across an imaginary vertical line that runs through the center of the image.

  • diagonal: Flip an image across its main diagonal that runs from the upper-left to the lower-right corner.

  • antidiagonal: Flip an image across its main diagonal that runs from the upper-right to the lower-left corner.

  • ("90|180|270"): Rotate an image clockwise by 90, 180, or 270 degrees.

Usage

If you do not specify the transpose parameter for the ImageFlip function, the image is transposed on a vertical axis, creating an image that is an upside-down version of the source. Use the ImageSetAntialiasing function to improve the quality of the rendered image.

Example

Example 1

<!--- This example shows how to rotate an image by 270 degrees. ---> 
<!--- Create a ColdFusion image from an existing JPEG file. ---> 
<cfimage source="../cfdocs/images/artgallery/paul03.jpg" name="myImage"> 
<!--- Turn on antialiasing to improve image quality. ---> 
<cfset ImageSetAntialiasing(myImage,"on")> 
<!--- Rotate the image by 270 degrees. ---> 
<cfset ImageFlip(myImage,"270")> 
<!--- Display the modified image in a browser. ---> 
<cfimage source="#myImage#" action="writeToBrowser">

Example 2

<!--- This example shows how to flip an image on a vertical axis. ---> 
<!--- Create a ColdFusion image from an existing JPEG file. ---> 
<cfimage source="../cfdocs/images/artgallery/paul03.jpg" name="myImage"> 
<!--- Turn on antialiasing to improve image quality. ---> 
<cfset ImageSetAntialiasing(myImage,"on")> 
<!--- Flip the image so that it is upside down. ---> 
<cfset ImageFlip(myImage,"vertical")> 
<!--- Display the modified image in a browser. ---> 
<cfimage source="#myImage#" action="writeToBrowser">

Example 3

<!--- This example shows how to flip an image on a horizontal axis. ---> 
<!--- Create a ColdFusion image from an existing JPEG file. ---> 
<cfimage source="../cfdocs/images/artgallery/paul03.jpg" name="myImage"> 
<!--- Turn on antialiasing to improve image quality. ---> 
<cfset ImageSetAntialiasing(myImage,"on")> 
<!--- Flip the image so that it is a mirror image of the source. ---> 
<cfset ImageFlip(myImage,"horizontal")> 
<!--- Display the modified image in a browser. ---> 
<cfimage source="#myImage#" action="writeToBrowser">

Example 4

<!--- This example shows how to flip an image on a diagonal axis. ---> 
<!--- Create a ColdFusion image from an existing JPEG file. ---> 
<cfimage source="../cfdocs/images/artgallery/paul03.jpg" name="myImage"> 
<!--- Turn on antialiasing to improve image quality. ---> 
<cfset ImageSetAntialiasing(myImage,"on")> 
<!--- Flip the image on a diagonal axis. ---> 
<cfset ImageFlip(myImage,"diagonal")> 
<!--- Display the modified image in a browser. ---> 
<cfimage source="#myImage#" action="writeToBrowser">

Example 5

<!--- This example shows how to flip an image on an antidiagonal axis. ---> 
<!--- Create a ColdFusion image from an existing JPEG file. ---> 
<cfimage source="../cfdocs/images/artgallery/paul03.jpg" name="myImage"> 
<!--- Turn on antialiasing to improve image quality. ---> 
<cfset ImageSetAntialiasing(myImage,"on")> 
<!--- Flip the image on an antidiagonal axis. ---> 
<cfset ImageFlip(myImage,"antidiagonal")> 
<!--- Display the modified image in a browser. ---> 
<cfimage source="#myImage#" action="writeToBrowser">