Description

Sets the background color for the ColdFusion image. The background color is used for clearing a region. Setting the background color only affects the subsequent ImageClearRect calls.

Returns

Nothing.

Category

Image functions

Function syntax

ImageSetBackgroundColor(image, color)

See also

ImageClearRectImageSetAntialiasingIsImageFile

History

ColdFusion (2018 release): Introduced named parameters.

ColdFusion 8: Added this function.

Parameters

Parameter

Description

image

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

color

Required. Background color:

  • Hexadecimal value of RGB color. For example, specify the color white as ##FFFFFF or FFFFFF.
  • String value of color (for example, "black", "red", "green"). The default value of the drawing color is "black".
  • List of three numbers for (R,G,B) values. Each value must be in the range 0-255.

Usage

If the color value is a string, specify a supported named color; see the list of valid HTML named colors in cfimage. For a hexadecimal value, use the form "##xxxxxx" or "xxxxxx", where x = 0-9 or A-F; use two number signs or none.Use this function in conjunction with the ImageClearRect function to clear a rectangular area of an image and set it to a specified color.

Example

<!--- Create a ColdFusion image from an existing JPEG file. --->
<cfimage name="myImage" source="../cfdocs/images/artgallery/maxwell01.jpg">
<!--- Turn on antialiasing to improve image quality. --->
<cfset ImageSetAntialiasing(myImage)>
<!--- Set the background color to magenta. --->
<cfset ImageSetBackgroundColor(myImage,"magenta")>
<!--- Clear the rectangle specified on myImage with the background color specified for the image. --->
<cfset ImageClearRect(myImage,36,45,100,100)>
<!--- Display the modified image in a browser. --->
<cfimage source="#myImage#" action="writeToBrowser">

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