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

ImageGrayscale

Last update:
May 18, 2026

Description

Converts a ColdFusion image to grayscale.

Returns

Nothing.

Category

Function syntax

ImageGrayscale(name)

See also

History

ColdFusion 8: Added this function.

Parameters

Parameter
Description
name
Required. The ColdFusion image on which this operation is performed.

Usage

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

Example

<!--- This example shows how to change a color image to grayscale. ---> 

<!--- Create a ColdFusion image from an existing color image. ---> 

<cfimage source="../cfdocs/images/artgallery/jeff04.jpg" name="myImage"> 

<!--- Turn on antialiasing to improve image quality. ---> 

<cfset ImageSetAntialiasing(myImage,"on")> 

<!--- Change the image to grayscale. ---> 

<cfset ImageGrayscale(myImage)> 

<!--- Save the grayscale image to a JPEG file. ---> 

<cfimage source="#myImage#" action="write" destination="test_myImage.jpg" overwrite="yes"> 

<!--- Display the source image and the grayscale image. ---> 

<img src="../cfdocs/images/artgallery/jeff04.jpg"/> 

<img src="test_myImage.jpg"/>

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