User Guide Cancel

ImagePaste

 

Description

Takes two images and an (x,y) coordinate and draws the second image over the first image with the upper-left corner at coordinate (x,y).

Returns

None

Category

Image functions

Function syntax

<!--- image1 gets modified --->
ImagePaste(image1, image2, x, y)
<!--- image1 gets modified ---> ImagePaste(image1, image2, x, y)
<!--- image1 gets modified ---> 
ImagePaste(image1, image2, x, y)

See also

ImageCopyImageOverlayImageSetAntialiasingIsImageFile

History

ColdFusion 8: Added this function.

Parameters

Parameter

Description

image1

Required. The bottom ColdFusion image.

Image2

Required. The ColdFusion image that is pasted on top of image1.

x

Required. The x coordinate where the upper-left corner of image2 is pasted.

y

Required. The y coordinate where the upper-left corner of image2 is pasted.

Usage

Use the ImageSetAntialiasing function to improve the quality of the rendered image.

Example

<!--- Create a ColdFusion image from an existing JPEG file and name it "myImage1". --->
<cfimage source="../cfdocs/images/artgallery/jeff05.jpg" name="myImage1">
<!--- Create a ColdFusion image from an existing JPEG file and name it "myImage2". --->
<cfimage source="../cfdocs/images/artgallery/maxwell01.jpg" name="myImage2">
<!--- Copy a rectangular region of myImage1. --->
<cfset resImage = ImageCopy(myImage1,1,1,50,50)>
<!--- Paste the rectangular area over myImage2. --->
<cfset ImagePaste(myImage2,resImage,100,100)>
<!--- Write the second ColdFusion image to result.jpg. --->
<cfimage source="#myImage2#" action="write" destination="test_myImage.jpg" overwrite="yes">
<!--- Display the two source images and the new image. --->
<img src="../cfdocs/images/artgallery/jeff05.jpg"/>
<img src="../cfdocs/images/artgallery/maxwell01.jpg"/>
<img src="test_myImage.jpg"/>
<!--- Create a ColdFusion image from an existing JPEG file and name it "myImage1". ---> <cfimage source="../cfdocs/images/artgallery/jeff05.jpg" name="myImage1"> <!--- Create a ColdFusion image from an existing JPEG file and name it "myImage2". ---> <cfimage source="../cfdocs/images/artgallery/maxwell01.jpg" name="myImage2"> <!--- Copy a rectangular region of myImage1. ---> <cfset resImage = ImageCopy(myImage1,1,1,50,50)> <!--- Paste the rectangular area over myImage2. ---> <cfset ImagePaste(myImage2,resImage,100,100)> <!--- Write the second ColdFusion image to result.jpg. ---> <cfimage source="#myImage2#" action="write" destination="test_myImage.jpg" overwrite="yes"> <!--- Display the two source images and the new image. ---> <img src="../cfdocs/images/artgallery/jeff05.jpg"/> <img src="../cfdocs/images/artgallery/maxwell01.jpg"/> <img src="test_myImage.jpg"/>
<!--- Create a ColdFusion image from an existing JPEG file and name it "myImage1". --->
<cfimage source="../cfdocs/images/artgallery/jeff05.jpg" name="myImage1">
<!--- Create a ColdFusion image from an existing JPEG file and name it "myImage2". --->
<cfimage source="../cfdocs/images/artgallery/maxwell01.jpg" name="myImage2">
<!--- Copy a rectangular region of myImage1. --->
<cfset resImage = ImageCopy(myImage1,1,1,50,50)>
<!--- Paste the rectangular area over myImage2. --->
<cfset ImagePaste(myImage2,resImage,100,100)>
<!--- Write the second ColdFusion image to result.jpg. --->
<cfimage source="#myImage2#" action="write" destination="test_myImage.jpg" overwrite="yes">
<!--- Display the two source images and the new image. --->
<img src="../cfdocs/images/artgallery/jeff05.jpg"/>
<img src="../cfdocs/images/artgallery/maxwell01.jpg"/>
<img src="test_myImage.jpg"/>

Get help faster and easier

New user?