Description

Create a new translucent image with given percentage of translucence.

Returns

Image object

History

ColdFusion 10: Added this function

Syntax

imageMakeTranslucent (imgpercent__)

Properties

Parameter

Description

img

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

percentage

Required. The percent of translucence:

  • 0 = opaque
  • 100 = transparent
    Decimal values are supported.

Example

The following example illustrates three images with the second one translucent than first and the thrid one translucent than the second.

<cfset myImage=ImageNew("",200,110)>
<!--- Set the drawing color to green. --->
<cfset ImageSetDrawingColor(myImage,"green")>
<!--- Turn on antialiasing to improve image quality. --->
<cfset ImageSetAntialiasing(myImage,"on")>
<!--- Draw a filled green oval on the image. --->
<cfset ImageDrawOval(myImage,5,5,190,100,"yes")>
<!--- Display the image in a browser. --->
<cfoutput>PNG image<br></cfoutput>
<cfset ImageWrite(myImage,"#expandpath('.')#/png.png")>
<cfset myImage = ImageRead("#expandpath('.')#/png.png")>
<cfimage source="#myImage#" action="writeToBrowser" >
<cfset x =ImageMakeTranslucent(myImage,50)>
<cfimage source="#x#" action="writeToBrowser" >
<cfset x =ImageMakeTranslucent(myImage,75)>
<cfimage source="#x#" action="writeToBrowser" >
<cfset x =ImageMakeTranslucent(myImage,100)>
<cfimage source="#x#" 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