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

Writing images to the browser

Last update:
May 18, 2026
Use the writeToBrowser action of the cfimage tag to display images directly in the browser without writing them to files. This technique is useful for testing the appearance of a ColdFusion image. The following example shows how to test the display of two effects applied to an image:
<cfset myImage=ImageNew("../cfdocs/images/artgallery/paul01.jpg")> 
<cfset ImageBlur(myImage,5)> 
<cfset ImageNegative(myImage)> 
<cfimage source="#myImage#" action="writeToBrowser">
The writeToBrowser action displays images in PNG format.
Also, you can write multiple images to the browser which is useful if you want to manipulate images in memory and display them without writing them to files. For example, you can duplicate several versions of the same image, display the versions in a browser, and allow the user to choose one of the images to write to a file. Or, you can extract images from a database, add a watermark to the images that appear in the browser, such as Proof or Draft, without having to write the modified images to files first. This way you can maintain one set of image files and change them on-the-fly. For an example of writing multiple images to the browser, see Generating a gallery of watermarked images in Application examples that use ColdFusion images.

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