Creates a ColdFusion image.

imageNew([source] [, width] [, height] [, imagetype] [, canvascolor]) → returns Image

Argument Reference for the imageNew function


Required: No
The source image path, URL, a variable that is read into the new image, or a Java buffered image.


Required: No
The width of the new image. Valid when the height is specified and the source is not.


Required: No
The height of the new image. Valid when the width is specified and the source is not.


Required: No
The type of the image to create (Valid only when width and height are specified), Values:
  • rgb
  • argb
  • grayscale


Required: No
Default: black
Color of the image canvas Values:
  • Hexadecimal value of RGB color. For example, specify the color white as ##FFFFFF or FFFFFF.
  • String value of color (for example, 'black', 'red', 'green').
  • List of three numbers for (R,G,B) values. Each value must be in the range 0-255.

Examples sample code invoking the imageNew function

Tag Syntax

Use the imageNew function to create a 200x200-pixel image in ARGB format.

<cfset myImage = imageNew("",200,200,"argb")> 
<cfimage action="writeTobrowser" source="#myImage#">

Tag Syntax

This example shows how to create a ColdFusion image from a URL.

<cfset myImage = imageNew("")> 
<cfset imageWrite(myImage,"google_via_imagenew.png")> 
<img src="google_via_imagenew.png">

Fork me on GitHub