HTML canvas ImageData widthProperty
Example
Output the width of the ImageData object:
alert("Width of imgData is: " + imgData.width);
Try it Yourself »
Browser Support
![]()
![]()
![]()
![]()
![]()
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; |
|---|
Other Extensions
Canvas Object