HTML canvas ImageData widthAttributes

HTML canvas 参考手册HTML canvas Reference Manual

Examples

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 property.

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


Definition and Usage

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

Tip:Please refer to thecreateImageData()、 getImageData()andputImageData()method for more knowledge about the ImageData object.


JavaScript Syntax

JavaScript syntax: imgData.width;


HTML canvas 参考手册HTML canvas Reference Manual Other Extensions