Whatever message this page gives is out now! Go check it out!

ImageMakeTranslucent

Last update:
May 18, 2026

Description

Create a new translucent image with given percentage of translucence.

Returns

Image object

History

ColdFusion 10: Added this function

Syntax

imageMakeTranslucent ( img , percent__)

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" >

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page