HTML canvas ImageData widthProperty

Canvas 对象参考手册Canvas Object

Example

Output the width of the ImageData object:

alert("Width of imgData is: " + imgData.width);

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 9, Firefox, Opera, Chrome, and Safari support the ImageData width attribute.

Note:Internet Explorer 8 and earlier versions do not support the <canvas> element.


Definition and Usage

The width attribute returns the width of the ImageData object, in pixels.

Tip:See alsocreateImageData()、 getImageData()andputImageData()method to learn more about the ImageData object.


JavaScript Syntax

JavaScript Syntax: imgData.width;


Canvas 对象参考手册Canvas Object

Other Extensions