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
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.width
height
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. |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 42 | (Yes) | 29.0 (29.0) | No support | 29 | ? |
Feature | Android Webview | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | No support | 42 | 29.0 (29.0) | No support | 29 | ? |
CanvasRenderingContext2D.createImageData()
, the creator method that can be used outside workers.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ImageData/ImageData