Learning ColdFusion 8: CFImage Part II - Tag Based Image Manipulation

<cffunction
	name="AlterImage"
	access="public"
	returntype="any"
	output="false"
	hint="Randomly alters an image and returns it.">
 
	<!--- Define arguments. --->
	<cfargument
		name="Image"
		type="any"
		required="true"
		/>
 
	<!---
		Copy the image and overwrite the passed in argument
		value. Since ColdFusion images are passed around by
		referene, this should create a COPY of the image and
		then save that new image reference over the one that
		was passed in.
	--->
	<cfimage
		action="read"
		source="#ARGUMENTS.Image#"
		name="ARGUMENTS.Image"
		/>
 
	<!--- Draw a random line. --->
	<cfset ImageDrawLine(
		ARGUMENTS.Image,
		RandRange( 0, ARGUMENTS.Image.GetWidth() ),
		RandRange( 0, ARGUMENTS.Image.GetHeight() ),
		RandRange( 0, ARGUMENTS.Image.GetWidth() ),
		RandRange( 0, ARGUMENTS.Image.GetHeight() )
		) />
 
	<!--- Return the altered image. --->
	<cfreturn ARGUMENTS.Image />
</cffunction>

For Cut-and-Paste