Wednesday, June 15, 2011

Writing text over an image

I know alot of people have already done this, but I thought I would share writing text over image as well. Only because the first time you do it, it's really cool.

Read in the image

<cfimage name = "local.image" action="read" source="test.jpg"/>


Turn on anti-aliasing ("softens jagged edges")

<cfset ImageSetAntiAliasing(local.image)/>


Set the text color

<cfset ImageSetDrawingColor(local.image, "000000")/>


Set extra attributes

<cfset local.attrs = {
Font = 'Arial',
Size = 36,
Style = 'bold'
}/>


Draw over the image (image,text,x-position,y-position,attributes)

<cfset ImageDrawText(local.image, "Hello World!", 10, 10, local.attrs)/>

No comments:

Post a Comment