Whatever message this page gives is out now! Go check it out!
Add a border to an image
<cfimage
required
action = "border"
source = "absolute pathname|pathname relative to the web root|URL|#cfimage variable#"
optional
color = "hexadecimal value|web color"
destination = "absolute pathname|pathname relative to the web root"
isBase64 = "yes|no"
name = "cfimage variable"
overwrite = "yes|no"
thickness = "number of pixels">
Create a CAPTCHA image
<cfimage
required
action = "captcha"
height = "number of pixels"
text = "text string"
width = "number of pixels"
optional
destination = "absolute pathname|pathname relative to the web root"
difficulty = "high|medium|low"
overwrite = "yes|no"
fonts = "comma-separated list of font names"
fontSize = "point size">
Convert an image file format
<cfimage
required
action = "convert"
destination = "absolute pathname|pathname relative to the web root"
source = "absolute pathname|pathname relative to the web root"|URL|#cfimage variable#
optional
isBase64 = "yes|no"
name = "cfimage variable"
overwrite = "yes|no">
Retrieve information about an image
<cfimage
required
action = "info"
source = "absolute pathname|pathname relative to the web root|URL|#cfimage variable#"
structname = "structure name"
optional
isBase64 = "yes|no">
Read an image into memory
<cfimage
required
name = "cfimage variable"
source = "absolute pathname|pathname relative to the web root|URL|#cfimage variable#"
optional
action = "read"
isBase64 = "yes|no">
Resize an image
<cfimage
required
action = "resize"
height = "number of pixels|percent%"
source = "absolute pathname|pathname relative to the web root|URL|#cfimage variable#"
width = "number of pixels|percent%"
optional
destination = "absolute pathname|pathname relative to the web root"
isBase64 = "yes|no"
name = "cfimage variable"
overwrite = "yes|no">
interpolation = "interpolation algorithm"
Rotate an image
<cfimage
required
action = "rotate"
angle = "angle in degrees"
source = "absolute pathname|pathname relative to the web root|URL|#cfimage variable#"
optional
destination = "absolute pathname|pathname relative to the web root"
isBase64= "yes|no"
name = "cfimage variable"
overwrite = "yes|no">
Write an image to a file
<cfimage
required
action = "write"
destination = "absolute pathname|pathname relative to the web root"
source = "absolute or relative pathname|URL|#cfimage variable#"
optional
isBase64= "yes|no"
overwrite = "yes|no"
quality = "JPEG image quality">
Write an image to the browser
<cfimage
required
action = "writeToBrowser"
source = "absolute pathname|pathname relative to the web root|URL|#cfimage variable#"
optional
format = "png|jpg|jpeg|webp"
isBase64= "yes|no">Attribute | Action | Req/Opt | Default | Description |
action | N/A | Optional | read | Action to take. Must be one of the following:
|
angle | rotate | Required | Angle in degrees to rotate the image.Specify an integer for the value. | |
color | border | Optional | black | Border color.Hexadecimal value or supported named color; see the name list in Valid HTML named colors section. For a hexadecimal value, use the form "##xxxxxx" or "xxxxxx", where x = 0-9 or A-F; use two number signs or none. |
destination | border captcha convert resizerotate write | Optional (see Description) | Absolute or relative pathname where the image output is written. The image format is determined by the file extension. The convert and write actions require a destination attribute. The border, captcha, resize, and rotateactions require a name attribute or a destination attribute. You can specify both. ColdFusion supports only CAPTCHA images in PNG format. Where the CAPTCHA image is placed depends on the following:
| |
difficulty | captcha | Optional | low | Level of complexity of the CAPTCHA text. Specify one of the following levels of text distortion:
|
fonts | captcha | Optional | One or more valid fonts to use for the CAPTCHA text. Separate multiple fonts with commas. If the specified font is not available, falls back to system fonts. | |
fontSize | captcha | Optional | 24 | Font size of the text in the CAPTCHA image. The value must be an integer. |
format | writeToBrowser | Optional | PNG | Format of the image displayed in the browser. If you do not specify a format, the image is displayed in PNG format. You cannot display a GIF image in a browser. GIF images are displayed in PNG format. |
height | captcha resize | Required | Height in pixels of the image. For the resize attribute, you also can specify the height as a percentage (an integer followed by the percent (%)symbol). When you resize an image, if you specify a value for the width, you can let ColdFusion calculate the aspect ratio by specifying "" as the height. If specified, the value must be an integer. | |
inter polation | resize | Optional | highest Quality | Specify a specific interpolation algorithm by name (for example, hamming), by image quality (for example,mediumQuality), or by performance (for example, highestPerformance). The following are the valid values:
|
isBase64 | border convert info read resizerotate writewrite ToBrowser | Optional | no | Specifies whether the source is a Base64 string:
|
name | border convertread resizerotate | Optional (see Description) | Name of the ColdFusion image variable to create. The read action requires a name attribute. The border, resize, and rotate actions require a name attribute or a destination attribute. You can specify both. | |
overwrite | border captcha conver tread resizerotate write | Optional | no | Valid only if the destination attribute is specified. The overwrite values are:
|
quality | write | Optional | 0.75 | Quality of the JPEG destination file. Applies only to files with an extension of JPG or JPEG. Valid values are fractions that range from 0 through 1 (the lower the number, the lower the quality). |
source | border convert info read resizerotate write write ToBrowser | Required |
| |
struct Name | info | Required | Name of the ColdFusion structure to be created. | |
text | captcha | Required | Text string displayed in the CAPTCHA image. Use capital letters for better readability. Do not include spaces because users cannot detect them in the resulting CAPTCHA image. | |
thickness | border | Optional | 1 | Border thickness in pixels. The border is added to the outside edge of the source image, increasing the image area accordingly. The value must be an integer. |
width | captcha resize | Required | Width in pixels of the image. For resize, you also can specify the width as a percentage (an integer followed by the % symbol). When you resize an image, if you specify a value for the height, you can let ColdFusion calculate the aspect ratio by specifying "" as the width. If specified, the value must be an integer. |
ram:///filepathColor name | RGB value |
Black | ##000000 |
Blue | ##0000FF |
Red | ##FF0000 |
Gray | ##808080 |
LightGray | ##D3D3D3 |
DarkGray | ##A9A9A9 |
Green | ##008000 |
Pink | ##FFC0CB |
Cyan | ##00FFFF |
Magenta | ##FF00FF |
Orange | ##FFA500 |
White | ##FFFFFF |
Yellow | ##FFFF00 |
<!--- This example shows how to create a ColdFusion image from an existing JPEG file, add a
five-pixel-wide red border to the image, and save it to a new JPEG file. --->
<cfimage source="../cfdocs/images/artgallery/jeff05.jpg" action="border" thickness="5"
destination="jeff05.jpg" color="red" overwrite="yes"><cfimage action="captcha" fontSize="25" width="400" height="150" text="rEadMe"
fonts="Arial,Verdana,Courier New">Use unique names for the CAPTCHA image files so that when multiple users access the CAPTCHA images, the files are not overwritten. |
<!--- Use the GetTickCount function to generate unique names for the CAPTCHA files. --->
<cfset tc = GetTickCount()>
<cfimage action="captcha" fontSize="15" width="180" height="50" text="rEadMe"
destination="images/rEadMe#tc#.png" difficulty="medium"><!--- This example shows how to convert a JPEG image to a PNG image. --->
<cfimage source="../cfdocs/images/artgallery/aiden02.jpg" action="convert"
destination="aiden02.png"><!--- This example shows how to retrieve and display image information. --->
<cfimage source="../cfdocs/images/artgallery/viata03.jpg" action="info" structName="viatoInfo">
<cfdump var="#viatoInfo#">
<!--- Alternatively, you can use the cfoutput tag to display specific image information, as
shown in the following example. --->
<cfoutput>
<p>height: #viatoInfo.height# pixels</p>
<p>width: #viatoInfo.width# pixels</p>
<p>source: #viatoInfo.source#</p>
<p>transparency: #viatoInfo.colormodel.transparency#</p>
<p>pixel size: #viatoInfo.colormodel.pixel_size#</p>
<p>color model: #viatoInfo.colormodel.colormodel_type#</p>
<p>alpha channel support: #viatoInfo.colormodel.alpha_channel_support#</p>
<p>color space: #viatoInfo.colormodel.colorspace#</p>
</cfoutput><!--- This code shows how to create a ColdFusion image from a JPEG file.
--->
<cfimage source="../cfdocs/images/artgallery/jeff01.jpg" name="myImage">
<!--- This code shows how to convert the image to grayscale. --->
<cfset ImageGrayscale(myImage)>
<!--- This code shows how to write the grayscale image to a JPEG file. --->
<cfimage source="#myImage#" action="write" destination="myGrayscaleImage.jpg" overwrite="yes"><!--- This example shows how to specify the height and width of an image in pixels. --->
<cfimage source="../cfdocs/images/artgallery/jeff01.jpg" action="resize" width="100" height="100" destination="jeff01_thumbnail.jpg" overwrite="yes">
<!--- This example shows how to specify the height and width of an image as percentages. --->
<cfimage source="../cfdocs/images/artgallery/jeff02.jpg" action="resize"
width="50%" height="50%" destination="jeff02_thumbnail.jpg" overwrite="yes">
<!--- This example shows how to specify the height of an image in pixels and its width as a
percentage. --->
<cfimage source="../cfdocs/images/artgallery/jeff03.jpg" action="resize"
width="50%" height="100" destination="jeff03_thumbnail.jpg" overwrite="yes"><!--- This example shows how to rotate an image by 30 degrees. --->
<cfimage source="../cfdocs/images/artgallery/maxwell01.jpg" action="rotate" angle="30"
name="maxwellAngle">
<!--- Display the rotated image in a browser. --->
<cfimage source="#maxwellAngle#" action="writeToBrowser"><!--- This example shows how to create a PNG file from a JPEG file by using the write action. --->
<cfimage source="../cfdocs/images/artgallery/aiden01.jpg" action="write"
destination="aiden01.png">
<!--- This example shows how to create a low-quality JPEG image. --->
<cfimage source="../cfdocs/images/artgallery/jeff05.jpg" action="write"
destination="jeff05_lq.jpg" quality=".5">
<!--- This example shows how to write a JPEG file to a new location. --->
<cfimage source="../cfdocs/images/artgallery/jeff05.jpg" action="write"
destination="jeff05.jpg"><!--- This example shows how to create a ColdFusion image from a JPEG file, resize it, and
then display it in the browser as a PNG image. --->
<cfimage source="../cfdocs/images/artgallery/jeff05.jpg" action="resize"
width="50%" height="50%" name="smLogo">
<cfimage source="#smLogo#" action="writeToBrowser"><!--- Create the ColdFusion image variable "myImage" from a JPEG file. --->
<cfimage source="../cfdocs/images/artgallery/jeff05.jpg" name="myImage">
<!--- Pass the ColdFusion image to the Image functions to blur the image by a radius of 5,
flip the image 90 degrees, and convert the image to grayscale. --->
<cfset ImageBlur(myImage,5)>
<cfset ImageFlip(myImage,"90")>
<cfset ImageGrayscale(myImage)>
<!--- Write the transformed image to a browser. --->
<cfimage source="#myImage#" action="writeToBrowser"><cfset imagePath = "fire.webp">
<cftry>
<cfimage action="read" source="#imagePath#" name="myImage">
<cfoutput>
Image read successfully.
</cfoutput>
<cfcatch type="image">
<cfoutput>
#cfcatch.message#
</cfoutput>
</cfcatch>
</cftry>
<!--- Apply blurring to the image --->
<cfset ImageBlur(myImage,10)>
<cftry>
<cfimage action="write" source="#myImage#" destination="blurred_fire.webp" overwrite="true">
<cfoutput>
Image blurred successfully.
</cfoutput>
<cfcatch type="image">
<cfoutput>
#cfcatch.message#
</cfoutput>
</cfcatch>
</cftry>