Skip to main content
createImageData method

Returns a CanvasImageData object with the given dimensions in CSS pixels.

The canvas element, Section 13 Internet Explorer 9



var retval = CanvasRenderingContext2D.createImageData(width, height);


width [in]

Type: number

The width of the new object, in CSS pixels.

height [in]

Type: number

The height of the new object, in CSS pixels.

Return value

Type: CanvasImageData

Standards information


When the CanvasImageData object is first created, it contains only pixels that are set to transparent black.

See also