Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML canvas ImageData width attribute

HTML canvas ImageData width attribute

Canvas Object Reference Canvas object

Example

Output the width of the ImageData object:

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

Try it »


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 .


Definition and Usage

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

**Tip:** See the createImageData(), getImageData() and putImageData() method, for more information about the ImageData object.


JavaScript syntax

JavaScript syntax: imgData.width;

Canvas Object Reference Canvas object