ImageOverlay

Description

Reads two source ColdFusion images and overlays the second source image on the first source image.

Returns

Nothing.

Category

Image functions

Function syntax

ImageOverlay(image1, image2 [, rule, alpha])

See also

ImageCopyImagePasteImageSetAntialiasingIsImageFile

History

ColdFusion (2018 release): Introduced named parameters.

ColdFusion 8: Added this function.

Parameters

Parameter

Description

image1

Required. The ColdFusion image that is the bottom layer in the ColdFusion image.

image2

Required. The ColdFusion image that is the top layer (overlaid on the source1 image) in the ColdFusion image.

rule

Optional. The following are the supported values: SRC, DST_IN, DST_OUT, DST_OVER, SRC_IN, SRC_OVER, or SRC_OUT. For details, see Java documentation.

alpha

Optional. The percentage value of transparency.

Usage

The destination image always has the same bounding rectangle as the first source image and the same image type as the two sources. If the two source images do not intersect, the destination image is the same as the first source image.The two source images must have the same color models. For example, you can overlay an RGB image over another RGB image, but you cannot overlay an RGB image on a grayscale image. To verify the color model of an image, use the ImageInfo function.Use the ImageSetAntialiasing function to improve the quality of the rendered image.

Example

<!--- This example shows how to overlay a smaller image on a
larger image. --->
<!--- Create a ColdFusion image from an existing JPEG file and enlarge it by 150%. This image is displayed in the background. --->
<cfimage source="../cfdocs/images/artgallery/maxwell01.jpg" name="myImage" action="resize" width="150%" height="150%">
<!--- Turn on antialiasing to improve image quality. --->
<cfset ImageSetAntialiasing(myImage,"on")>
<!--- Create a ColdFusion image from an existing JPEG file. This image is overlaid on the background image. --->
<cfimage source="../cfdocs/images/artgallery/viata05.jpg" name="topImage">
<!--- Overlay the top image on the background image. --->
<cfset ImageOverlay(myImage,topImage)>
<!--- Display the combined image in a browser. --->
<cfimage source="#myImage#" action="writeToBrowser">

Adobe logo

Sign in to your account