This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The ImageData() constructor returns a newly instantiated ImageData object build from the typed array given and having the specified width and height.

This constructor is the preferred way of creating such an object in a worker.


var imageData = new ImageData(array, width, height);
var imageData = new ImageData(width, height);


array Optional
A Uint8ClampedArray containing the underlying pixel representation of the image. If no such array is given, an image with a black rectangle of the given dimension will be created.
An unsigned long representing the width of the represented image.
An unsigned long representing the height of the represented image. This value is optional if an array is given: it will be inferred from its size and the given width.


var imageData = new ImageData(100, 100); // Creates a 100x100 black rectangle
// ImageData { width: 100, height: 100, data: Uint8ClampedArray[40000] }


Specification Status Comment
HTML Living Standard
The definition of 'ImageData()' in that specification.
Living Standard Initial definition.

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
Chrome Full support 42Edge Full support YesFirefox Full support 29IE No support NoOpera Full support 29Safari ? WebView Android No support NoChrome Android Full support 42Edge Mobile ? Firefox Android Full support 29Opera Android ? Safari iOS ? Samsung Internet Android Full support 4.0


Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.

See also


Document Tags and Contributors

Contributors to this page: fscholz, jpmedley, zbjornson, DevelX, teoli
Last updated by: fscholz,