For the complete experience, please enable JavaScript in your browser. Thank you!

  • Creative Cloud
  • Photoshop
  • Illustrator
  • InDesign
  • Premiere Pro
  • After Effects
  • Lightroom
  • See all
  • See plans for: businesses photographers students
  • Document Cloud
  • Acrobat DC
  • eSign
  • Stock
  • Elements
  • Marketing Cloud
  • Analytics
  • Audience Manager
  • Campaign
  • Experience Manager
  • Media Optimizer
  • Target
  • See all
  • Acrobat Reader DC
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player
  • All products
  • Creative Cloud
  • Individuals
  • Photographers
  • Students and Teachers
  • Business
  • Schools and Universities
  • Marketing Cloud
  • Document Cloud
  • Stock
  • Elements
  • All products
  • Get Support
    Find answers quickly. Contact us if you need to.
    Start now >
  • Learn the apps
    Get started or learn new ways to work.
    Learn now >
  • Ask the community
    Post questions and get answers from experts.
    Start now >
    • About Us
    • Careers At Adobe
    • Investor Relations
    • Privacy  |  Security
    • Corporate Responsibility
    • Customer Showcase
    • Events
    • Contact Us
News
    • 3/22/2016
      Adobe Summit 2016: Are You An Experience Business?
    • 3/22/2016
      Adobe Announces Cross-Device Co-op to Enable People-Based Marketing
    • 3/22/2016
      Adobe and comScore Advance Digital TV and Ad Measurement
    • 3/22/2016
      Adobe Marketing Cloud Redefines TV Experience
CFML Reference / 

ImageAddBorder

Adobe Community Help


Applies to

  • ColdFusion

Contact support

 
By clicking Submit, you accept the Adobe Terms of Use.
 

Description

Adds a rectangular border around the outside edge of a ColdFusion image.

Returns

Nothing.

Category

Image functions

Function syntax

ImageAddBorder(name, thickness [, color, borderType])

See also

cfimage, ImageDrawRect, IsImageFile

History

ColdFusion 8: Added this function.

Parameters

Parameter

Description

name

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

thickness

Required. Thickness of the border in pixels. The default value is 1. The border is added to the outside edge of the image; the image area is increased accordingly.

color

Optional. Border color. The default border color is black. See Usage.Only valid if the borderType is not specified or if borderType = "constant".

borderType

Optional. The type of border:

  • zero: Sets the border color to black.
  • constant: Sets the border to the specified color (default).
  • copy: Sets sample values to copies of the nearest valid pixel. For example, pixels to the left of the valid rectangle assume the value of the valid edge pixel in the same row. Pixels both above and to the left of the valid rectangle assume the value of the upper-left pixel.
  • reflect: Mirrors the edges of the source image. For example, if the left edge of the valid rectangle is located at x = 10, pixel (9, y) is a copy of pixel (10, y) and pixel (6, y) is a copy of pixel (13, y).
  • wrap: Tiles the source image in the plane.

Usage

Thickness of the border in pixels. The default value is 1. The border is added to the outside edge of the image; the image area is increased accordingly.

Example

Example 1

<!--- This example shows how to create a 10-pixel-wide red border around an image with a 5-pixel-wide green border around the red border.---> 
<!--- Create a ColdFusion image from an existing JPEG file. ---> 
<cfimage source="../cfdocs/images/artgallery/jeff05.jpg" name="myImage"> 
<!--- Draw a red border around the outside edge of the image. ---> 
<cfset ImageAddBorder(myImage,10,"red")> 
<!--- Draw a green border around the outside edge of the red border. ---> 
<cfset ImageAddBorder(myImage,5,"green")> 
<!--- Save the modified ColdFusion image to a file. ---> 
<cfimage source="#myImage#" action="write" destination="test_myImage.jpeg" overwrite="yes"> 
<!--- Display the source image and the new image. ---> 
<img src="../cfdocs/images/artgallery/jeff05.jpg"/> 
<img src="test_myImage.jpeg"/>

Example 2

<!--- This example shows how to create a border from the tiled image. ---> 
<!--- Create a ColdFusion image from an existing JPEG file. ---> 
<cfimage source="../cfdocs/images/artgallery/lori05.jpg" name="myImage"> 
<!--- Add a 50-pixel-wide border to the outside edge of the image that is a tiled version of the image itself. ---> 
<cfset ImageAddBorder(myImage,50,"","wrap")> 
<!--- Save the modified ColdFusion image to a file. ---> 
<cfimage source="#myImage#" action="write" destination="test_myImage.jpeg" overwrite="yes"> 
<!--- Display the source image and the new image. ---> 
<img src="../cfdocs/images/artgallery/lori05.jpg"/> 
<img src="test_myImage.jpeg"/>

Example 3

<!--- This example shows how to create a 100-pixel-wide border that is a mirror of the source image. ---> 
<!--- Create a ColdFusion image from an existing JPEG file. ---> 
<cfimage source="../cfdocs/images/artgallery/maxwell01.jpg" name="myImage"> 
<!--- Create the border. ---> 
<cfset ImageAddBorder(myImage,100,"","reflect")> 
<!--- Save the modified ColdFusion image to a file. ---> 
<cfimage source="#myImage#" action="write" destination="test_myImage.jpeg" overwrite="yes"> 
<!--- Display the source image and the new image. ---> 
<img src="../cfdocs/images/artgallery/maxwell01.jpg"/> 
<img src="test_myImage.jpeg"/>

Example 4

<!--- This example shows how to copy 100 pixels from the outer edge of the image and create a border from it. ---> 
<!--- Create a ColdFusion image from an existing JPEG file. ---> 
<cfimage source="../cfdocs/images/artgallery/jeff05.jpg" name="myImage"> 
<cfset ImageAddBorder(myImage,100,"","copy")> 
<!--- Save the modified ColdFusion image to a file. ---> 
<cfimage source="#myImage#" action="write" destination="test_myImage.jpeg" overwrite="yes"> 
<!--- Display the source image and the new image. ---> 
<img src="../cfdocs/images/artgallery/jeff05.jpg"/> 
<img src="test_myImage.jpeg"/>

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy

Choose your region United States (Change)   Products   Downloads   Learn & Support   Company
Choose your region Close

Americas

Europe, Middle East and Africa

Asia Pacific

  • Brasil
  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Cyprus - English
  • Česká republika
  • Danmark
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Greece - English
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • Malta - English
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • Southeast Asia (Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam) - English
  • 台灣

Commonwealth of Independent States

  • Includes Armenia, Azerbaijan, Belarus, Georgia, Moldova, Kazakhstan, Kyrgyzstan, Tajikistan, Turkmenistan, Ukraine, Uzbekistan

Copyright © 2016 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy | Cookies

AdChoices