The readonly ImageData.width property returns the number of pixels per row in the ImageData object.
imageData.width
This example creates an ImageData object that is 200 pixels wide and 100 pixels tall. Thus, the width property is 200.
let imageData = new ImageData(200, 100); console.log(imageData.width); // 200
| Specification | Status | Comment |
|---|---|---|
| HTML Living Standard The definition of 'ImageData.width' in that specification. | Living Standard | Initial definition. |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | Yes | 12 | 14 | 9 | 9 | 3.1 |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | Yes | Yes | Yes | 14 | Yes | Yes | Yes |
© 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/width